javascript - AJAX catch difference between «failed» and «canceled» sending request to another domain -
i'm making ajax request server on domain don't actially need response, know got request. when ok, in chrome developer tools (header status) says «canceled» , console writes «xmlhttprequest cannot load» server gets requests. when server down header status not number «failed». trying catch critical difference on js xhr status 0 in both cases.
i'm making ajax request server on domain
you can't make ajax request different domain, due same-origin policy. want @ jsonp, writes out <script>
tag remote url.
detecting success/error jsonp calls tricky, doesn't work typical ajax calls @ all. ideally want remote server call callback function on page, above link describes.
if don't control other domain, can attempt detect errors using timeout. here post discussing jquery timeout argument this, though implement own timeout raw javascript well.
Comments
Post a Comment