ruby on rails - How to access response of ajax request, fired by clicking on a link? -


i have link, clicking on ajax post request fired up. this:

$('a#create_object').click(); 

this fires ajax request. code ($.ajax({...})) written somewhere in bootstrap libs , not want edit thwem.

how access response of request after ajax successes?

the direct callbacks deprecated since jquery 1.8.0, can use .done, .fail , .always callbacks !

and have overwrite / access callbacks if want stuff, cannot access external mean !

$('#link').on('click', function(e) {     $.ajax({         type: "post",         url: "your-page",         data: {},         datatype: "json"     }).done(function (response) {         alert('success');         console.log(response); // use here     }).fail(function (response) {         alert('fail');         console.log(response); // use here     }).always(function (response) {         // here manage every-time, when it's done or failed.     }); }); 

Popular posts from this blog

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -