V
V
voe2015-12-09 12:30:54
JavaScript
voe, 2015-12-09 12:30:54

What is the correct way to call ajax via jQuery in a rails application?

I figured out how to work with Ajax through helpers and the remote true parameter.
But here, through jQuery, I can’t figure out how to call ajax and correctly process it on the server and return it to the client.
there is a checkbox on the form there
is javascript that monitors the checkbox switching, how can I call an ajax request to the server on the check event (I catch it without problems) and process it both on the server side and on the client side?
Interested in returning both in html and json format.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Kozhin, 2015-12-09
@kkzhn

An example of such processing is shown in the video: railscasts.com/episodes/136-jquery?autoplay=true
There is a code example below on the page.

A
Artem Pyankov, 2015-12-11
@ibub1ik

And what exactly is the problem?
api.jquery.com/jquery.ajax
api.rubyonrails.org/classes/ActionController/MimeR...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question