Rectangle 27 0

jquery Ajax no redirect?

<button type='button' id='some_id'>Submit</button>
<%= form_for ..., remote: true do |f| %>
  # your form
def create
  # ...
  respond_to do |format|
    format.js {render json: word}

However, if you still want to submit your data with your own AJAX request, you can just disable your submit button:

Instead of making a manual AJAX request, I advise you to use the remote: true parameter of the form_for:

Thanks, I removed the button and now is working fine.

Then, in your create action, you can simply do:

You can read more about the remote option here