Skip to content
Advertisement

Tag: file-io

How do I check if file exists in jQuery or pure JavaScript?

How do I check if a file on my server exists in jQuery or pure JavaScript? Answer With jQuery: EDIT: Here is the code for checking 404 status, without using jQuery Small changes and it could check for status HTTP status code 200 (success), instead. EDIT 2: Since sync XMLHttpRequest is deprecated, you can add a utility method like this

Advertisement