javascript - jQuery or JS : Piggyback on post return? -
i'm looking way fire event when post ajax call completes , perform action on returned data outside script/plugin without modifying post callbacks code too. see pseudo code:
$.post(url, {id: 3,...}, function( d ) { ...some js code here }); //looking event : $(document).on('post', '??' ,function() { //i want access 'd' post callback in here, , other post calls return data... }
try utilizing .ajaxcomplete()
$(document).ajaxcomplete(function(event, jqxhr, settings) { // want access 'd' post callback in here, // , other post calls return data... // stuff when `$.post()` completes console.log(jqxhr.responsetext); // `d` }); $.post(url, {id: 3,...}, function( d ) { // stuff // ...some js code here });
Comments
Post a Comment