开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜