I am building a web-site that calls php on the backend for some pages. When I view the html page on a computer browser, it returns with a status of 200 and shows content returned from php script. However, when I view the same page on my iphone it returns a status of 0 (and subsequently nothing is returned/displayed). Here is a sample of the code - very simple.
Here is what the html page looks like at the script location:
<script>
function load() {
var httpr = new XMLHttpRequest();
httpr.onreadystatechange = function() {
if (httpr.readyState == 4 ) { // && httpr.status == 200
alert(httpr.status);
}
}
httpr.open("GET", "https://www.mywebsite/myphpscript.php", true);
httpr.send();
}
load();
</script>
When I go view the page on my iphone, and am tailing the php logfile on my webserver, I do see messages (debug ones I put in the php code), so I know its firing/executing (as of now, the code simply displays some text that I want to parse). If I simply use my iphone to view the php page itself (go directly to the php file v.s. the web-page that includes the php file), it does respond with what I expect to see. It just doesn't work from the html page that invokes the php script via xmlhttprequest.
Any idea why?