ajax call to server fails
I've been trying to do a quick timed "server status" script, but it's not working for remote servers (only for local files). I get a consistent errors return even on 200 status return codes for remote servers. ie. url:"file.ext" works while url:"http://server.address" doesn't. Below is the snippet:
- function srvstats(){
$.ajax({
url: "http://server.address.goes.here/",
cache: false,
success:function(response){
$("#serverstatus").removeClass("down").addClass("up");
$("#serverstatus").html("Server is Running");
},
error:function(response){
$("#serverstatus").removeClass("up").addClass("down");
$("#serverstatus").html("Server is Down");
}
});
}
setInterval("srvstats()", 10000);
srvstats();
Same across all tested browsers, multiple servers, etc. I've tried rolling back to using statusCode, with no success. Any help is greatly appreciated!