Refire certain scripts after jQuery AJAX load
I need 开发者_如何学JAVAcertain scripts to refire after an AJAX load. How could I accomplish this?
You could use the success callback to invoke the functions you want to refire.
$.ajax({
url: '/url',
success: function() {
func1();
func2();
}
});
If you just need to reattach events try the live method.
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
精彩评论