jQuery handle/hide expected Ajax 404 Error

后端 未结 1 1940
甜味超标
甜味超标 2021-01-18 05:16

I use an ajax head request to check for a file. In most cases the file wouldn\'t exist and it would be nice to somehow prevent the 404 to show up in my debug console. Is th

相关标签:
1条回答
  • 2021-01-18 05:47

    No, unfortunately, you cannot.

    404 errors are handled internally, you cannot suppress the error, not even with overwriting the error events in javascript or try-catching it.

    You could write a serverscript to check if a certain file exists and call that one to check if the file exists before calling the file that might not exist.

    0 讨论(0)
提交回复
热议问题