简体   繁体   中英

Stop jQuery from console logging on failed XHR GET request

I am trying to load a page when it is done with certain processes. When the process is still running, it returns a 503 error code, when the page is loaded, it returns a 200 code.

I am doing this via the $.get function. However, when jQuery get's a 503 error code (and probably also with other error codes), it logs this in the console:

XHR failed loading: GET "URL".

Example:

在此处输入图片说明

How do I remove this console.log() ?

The logging entry in chrome's console is a behaviour of chrome when any HTTP request is handled, not a problem with jQuery or ajax(XMLHttpRequest), even an or tag could cause this issue.

So you cannot stop the chrome browser from logging 503 errors in console. Instead you should correct the server side implementation. The server should return 200 even if the process is running, with a response data indicating that the process is running. (You may run your process in background thread on the server asynchronously and return the response on the main thread.)

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