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

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -