Tutorial :Refire certain scripts after jQuery AJAX load



Question:

I need certain scripts to refire after an AJAX load. How could I accomplish this?


Solution:1

You could use the success callback to invoke the functions you want to refire.

$.ajax({      url: '/url',      success: function() {          func1();          func2();      }  });  


Solution:2

If you just need to reattach events try the live method.


Solution:3

Use the callback function

A callback is a plain JavaScript function passed to some method as an argument or option. Some callbacks are just events, called to give the user a chance to react when a certain state is triggered. jQuery's event system uses such callbacks everywhere:

More info here


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »