JQuery error log suppression

In jQuery, I use ajax call to determine if a directory exists. If he gives a 403 error, he must do one thing; if he gives 404, he must use a different directory.

Everything works as it should. Now the problem occurs whenever an error occurs jQuery writes the error to the firebug console. This should not happen.

Is there a way to suppress error logging in jQuery?

$.ajax({ url: "../media/", complete: function(xhr, statusText) { if(xhr.status == 403) { //server is jetty mediaFolder = "../media/"; } }}); 
+4
source share
2 answers

There is no built-in method, error 404 is an error and it displays correctly in the console (the error message comes well directly from the XMLHTTP object, not jQuery)

If you want to avoid using a script to check the server itself

 url: "check_dir_and_return_parsable_result.blah?path=/xx/yy" ... 
+1
source

Yes, undo all console.log() lines in the code that are the likely reason for registering

0
source

Source: https://habr.com/ru/post/1403437/


All Articles