My controller
def destroy
@image.destroy
respond_to do |format|
format.html
format.json { render json: 'success' }
end
end
I need this request from html, then it redirects to: back, like
flash[:notice] = "Image Successfully deleted"
redirect_to :back
It works fine when I can't handle json. I want to combine both of them so that they send a response according to the html or ajax request
source
share