简体   繁体   中英

jquery ajax response “readyState”:0,“status”:0,“statusText”:“error”

I am getting "readyState":0,"status":0,"statusText":"error" ajax response for making an http request to load json file.

The web page has loaded inside an iframe and there is no code to change the URL within the webpage while making an ajax request.

Here's the Ajax config

url: 'some file in the same domain',
method: 'GET',
dataType: 'JSON'

I am not able to re-create this situation but this has been logged in trackJS.

This signature of Network Error can occur when there is a pending XHR request that is cancelled. The request can be canceled by the browser when the page is closing, or by a browser extension if it has been blocked. For example, if there is an adblocker extension present, some network requests might show up this way.

I'd suggest examining your data in TrackJS to see if the problem is limited to a small subset of users. You may be able to safely ignore this.

As a way to recreate it, you can download an adblocker extension, such as "ublock origin", which can accept custom rules. Add a custom blocking rule for a URL that your application uses, and you should see the error.

You can also use this mechanism to block the same URLs being requested in your TrackJS error reports, and see what the impact is on end users. Make sure you have appropriate fallbacks in case the requests fail and you don't leave the user in a volatile state.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM