I'm working on a phoneGap app using the file:// protocol. I keep getting this error when using ajax. I have header("Access-Control-Allow-Origin:*") on my server page. But no matter what I'm can't get an ajax response. What do I do?
Failed to load file:///C:/test4/www/trackmyrunning.byethost22.com: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
$("#b").on('click',function(){
//pull vars
var username = $('#username').val();
var password = $('#password').val();
$.ajax({
url: "trackmyrunning.byethost22.com",
type: 'POST',
success: function(data)
{
$("#loginMessage").html(data);
},
error: function(xhr, status,error)
{
alert(xhr.status + status + error);
}
});
//request for username
/* $.get("trackmyrunning.byethost22.com/index.", {user:username,pass:password}).done(function(data){
$("#loginMessage").html(data);
}); */
});
I also have as well. I tried modifying it to and no luck. The error message I get in the alert is 0 error, basically access denied do to cross origin.