Check if a File Exists


/ Published in: jQuery
Save to your folder(s)

Nice jquery script to check if a file exists, written by ambitionlab


Copy this code and paste it in your HTML
  1. $.ajax({
  2. url:'http://www.example.com/somefile.ext',
  3. type:'HEAD',
  4. error:
  5. function(){
  6. //do something depressing
  7. },
  8. success:
  9. function(){
  10. //do something cheerful :)
  11. }
  12. });

URL: http://www.ambitionlab.com/how-to-check-if-a-file-exists-using-jquery-2010-01-06

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.