Validate if website exists with AJAX
<p>I'm trying to check if a website exists with an ajax call, but I'm not sure I am getting it right. On my page I grab a URL on click</p>

<pre><code>$("#go").click(function() {
    var url = $("#url").val();
    $.ajax({
        type: "POST",
        url: "/ajax.php",
        data: "url="+url,
        success: function(){
          $("#start").remove();
        },      
        error: function(){
        alert("Bad URL");
        }
    });     
});
</code></pre>

<p>a=And then check on ajax.php</p>

<pre><code>$url = $_POST['url'];

ini_set("default_socket_timeout","05");
set_time_limit(5);
$f=fopen($url,"r");
$r=fread($f,1000);
fclose($f);
if(strlen($r)&gt;1) {
    return true;
} else {
    return false;
}
</code></pre>

<p>It seems I am getting SUCCESS no matter what... What am I missing?</p>
