How to check, is file exist on current site?
Like:
if ('http://site.com/girlfirend.png' exist) {
// do something
}
Maybe I can use .get
? But how to check its status (ok or 404)?
Thanks.
How to check, is file exist on current site?
Like:
if ('http://site.com/girlfirend.png' exist) {
// do something
}
Maybe I can use .get
? But how to check its status (ok or 404)?
Thanks.
Issue a get request to the file and inspect the result.
See Ajax in jquery
Use jQuery, this has been asked here:
http://stackoverflow.com/questions/197228/how-to-check-if-a-file-exists-in-javascript