check for file existence on the web using url passed
<p>Friends:</p>

<p>I found these 2 pieces of code to test for file existence over the web.
    The JQuery version is very popular all over and the second one is simple javascript.
    I just grabbed a file from yahoo.com -- 
    <a href="http://l.yimg.com/cv/mntl/tra/11q2/img_48880236.jpg" rel="nofollow">http://l.yimg.com/cv/mntl/tra/11q2/img_48880236.jpg</a></p>

<p>and made a small .html file using the code below. But i always get SUCCESS(or rather EXISTS) in my message, even after i modified the .jpg file
    mentioned above. I tried my .html file in IE* and Google chrome. Had linked the following jQuery file - jquery-1.4.2.min.js.
    Any help or suggestions would be welcome.</p>

<p>JQuery version - </p>

<pre><code>$.ajax({
    url:'http://l.yimg.com/cv/mntl/tra/11q2/img_48880236--.jpg',
    type:'HEAD',
    error:
        function(){
            alert('DOES NOT EXISTS');
        },
    success:
        function(){
            alert('EXISTS');
        }
});
</code></pre>

<p>Javascript version - </p>

<pre><code>var _url="http://l.yimg.com/cv/mntl/tra/11q2/img_48880236--.jpg" ;
var http = new XMLHttpRequest();
http.open('HEAD', _url, false);
http.send();
http.status !=404 ? alert('EXISTS') : alert('DOES NOT EXIST') ;
</code></pre>
