How to do: render => nothing works

I have a jquery AJAX call that loads a window. There is a form in the window with a message allowing users to upload an item. I need to do this second form using regular submission so that I can request a download.
My problem is that there is no file to download, it is redirected to the page where this file is located.
I try a lot of different styles to make nothing do anything, but none of them seem to work.

unless params[:controller] == "reports" unless @jobs.present? flash.now[:error] = "No work orders for this selection." render :nothing => true end end 

Besides

 respond_to do |format| format.html { render :nothing => true } end 

Nothing seems to work. Any ideas?

+6
source share
1 answer

Do not use render: nothing. . This will be ajax crash request. Use instead:

 render json: nil, status: :ok 
+18
source

Source: https://habr.com/ru/post/913429/


All Articles