jQuery check external link
<p>Using Javascript or jQuery, how can I check if an external link is available? </p>

<p>An <code>$.ajax()</code> call is not available as it violates <a href="http://en.wikipedia.org/wiki/Same_origin_policy" rel="nofollow">SOP</a> (same problem as <a href="http://stackoverflow.com/questions/7234297/jquery-not-working-for-external-domains">here</a>). I have read about <a href="http://en.wikipedia.org/wiki/JSONP" rel="nofollow">JSONP</a>, but I would like to know if there is a more straight solution, as I don't want to load any data from the external server; what I need is only to check if it is reachable.</p>

<hr>

<p>EDIT (answer)</p>

<p>I solved it with the following code:</p>

<pre><code>$.ajax({url: 'http://www.example.com',
        type: 'GET',
        dataType: 'jsonp',
        complete: function(jqXHR, textStatus) {
                console.log(jqXHR.status);  // '200' = url reachable
        },
        timeout: 2000
});
</code></pre>

<p>The only problem now is that I get a <code>Parse error</code>, but in any case it can be checked if the external link is working.</p>
