chrisp
chrisp

Reputation: 2249

How do I customise the ajax call when using form_tag's 'remote' in Rails?

Since ujs is assigning the event handler by simply including the jquery ujs source, how do I override any of the $.ajax settings for the specific call?

So many examples use the global methods. Is this just the preferred method?

(I asked an earlier question where I thought all the customisation was available through the data-* attributes.)

Upvotes: 2

Views: 218

Answers (1)

RobHeaton
RobHeaton

Reputation: 1390

You can bind to a specific element's AJAX success by:

$element.bind("ajax:success", function(xhr, data, status){
  doSomeStuff();
});

Upvotes: 1

Related Questions