I am making a dashcode webapp and all I want is a single digit, a 1 or 0 returned from an external server so if there is an easier way to do this please let me know. I am using the plug in found at http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/ to try to make a cross domain request, but everything I am trying isn't working.
When I run this code
$.ajax({
url: "status.html",
context: document.body,
success: function(data){
alert("working" + data);
}
});
everything works perfectly and an alert with the text "working1" is displayed, but when I run this code
$.ajax({
url: "http://externalsite.com/status.html",
context: document.body,
success: function(data){
alert("working" + data);
}
});
nothing happens. Can anyone help? This is just what I am trying now, I've also tried a .get request and the returned data was "objectObject" I also tried a php proxy without any luck. I'm just asking for a simple solution to return a SINGLE number from an external server.
If you can control other server output, put header:
Access-Control-Allow-Origin: *
in http response, and load with ajax without plugins or using YQL