title: How to check if a file exists in javascript?
body: <p>I'm using the jquery library to load the content of an html file. Something like this:</p>
  
  <p>$("#Main").load("login.html")</p>
  
  <p>If the file (in this case 'login.html') does not exist, I would like to detect it so that I can redirect the user to an error page for example. Any ideas how I can detect if the file to load exists or not?</p>