ajax - get statusCode inside jQuery load event handler -
Markup code:
I am using jQuery's AJAX event 'Load' H1> I have to obtain the status code in my weight event callback. Maybe get the Is this possible? And, I can manually change the src attribute of the iframe, which will also trigger the First of all, it is usually iframes . HTML: Javascript: Some other suggestions on this question Carefully Walking With Another Post also did not use " As a bonus treatment (if you are possibly misleading), you can easily customize the above code to use the loading animation. / Em> Reference: & lt; Iframe id = "my_iframe" src = "http: // somewhere" & gt; & Lt; / Iframe & gt;
jQuery code:
$ (function () {$ ('# my_frame'). Load (function (data) {// content load Maybe 404/500 here or else. If (statusCode == 400) {// do something.} Else {// do something else}}}}}});
question
jqxhr object?
load event, it seems that this is not an AJAX call.
& lt; Div & gt; By using the element you should be able to meet all your requirements.
& lt; Div id = "dynamic page" & gt; Loading ... & lt; / Div & gt;
$ ("#dynamic page") Load ("http: // somewhere", function (response, position, xhr) {if (condition == "success") {// successfully request //} and (status == "error" || condition == " Timeout ") {// error and TIMEOUT request / / var msg =" Sorry! An error has occurred, please try again later "; $ (" #dynamic page ") .html (msg);} and if (Status == "No Modified") {// No Modified Request (Expected Cached) // If else (Status == "Abortion") {// ABORTED Request}}}}
success" as
jQuery.load () and misspelling "
success: " "
Comments
Post a Comment