开发者

How come jQuery doesn't always load?

In my code, I have:

$(document).ready(function() {
    $.ajaxSetup ({
   开发者_开发百科     // Disable caching of AJAX responses */
        cache: false
    });

    //pop_i = setInterval( "load_result()", 1000 );
    load_result();
    load_f();
});

but it doesn't always load. I know this because load_f() has an alert which doesn't get triggered sometimes.


Don't know if this applies to your situation.

I've just come across an issue whereby $(document).ready() event wasn't being fired. As it turns out, the jQuery $(document).ready() event is not fired in async postbacks when used w/ ASP.net UpdatePanels. One solution is to refactor the $(document).ready() logic into an explicit function () so that it can also be registered w/ the ASP.net Sys.WebForms.PageRequestManager endRequest event (fired on every async postback). Details can be found on the question I posted earlier today...


If you are sure your JavaScript looks right and you're not getting any errors in Firebug, chances are it's the JSON being sent back from the server that's tripping things up.

Where load_f fails to run copy-paste the result of your GET/POST requests from Firebug into your text-editor and pour through them with a fine-tooth comb to make sure the JSON is well-formed.


What happens in load_result and load_f? Since the ready function attaches a listener, if an error occurs you will sometimes not see it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜