How to not follow form submit after sending data in Rails

I have a form in my view.

I only want to submit the data, without the rendering of any other template or following the post request to a new URL.

Are there any solutions to this besides structuring the whole thing about AJAX?


I have a multipart form.. part 1 submits data to a cache (using AJAX), then I use JQuery to hide that part of the form and show part 2. Part 2 is what submits the main data to a rails controller. That controller action is responsible for pulling the previously cached data and sending a POST request to an API that stores part 1 and part 2 in a database.

What I would like to do: Have the rails app receive the form data and process the request, then I could use an AJAX request to append data to the page (clearing out the form, and showing the compiled data submitted if the post was successful, and an error message if not).


I have tried the following and it does nothing when clicked:

        $(this).submit(); //also tried .send();


you could either redirect to the same page or maybe do this

//Do other thing, or maybe nothing

In your controller do the following:

respond_to do |format|
  format.all { render nothing: true, status: 200 }

Need Your Help

OpenCV Error: Assertion failed in cross correlation

c++ opencv

I am getting this error when I try to run my code:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.