Skip to content Skip to sidebar Skip to footer

What Is Passed To The Success Function In An Ajax Delete Request?

I am currently working on a React-Rails app and am trying to figure out how to pass a deleted record to a parent component from the success function to update the parent component'

Solution 1:

You need to edit the Rails RecordsController so that it renders some type of data after the request. I recommend JSON.

def destroy
  record = Record.find(params[:id])
  record.destroy
  render json: recordend

With that you will have the JSON form of the record that you just delete passed back to the success function of the AJAX call.

Post a Comment for "What Is Passed To The Success Function In An Ajax Delete Request?"