Ajax calls to HTTPS. Android PhoneGap XHR status=0
I want to make AJAX calls to HTTPS from HTTP, but have XHR.status=0
.
I use following code to make the call:
$j.ajax({
type: method || "GET",
async: this.asyncAjax,
url: url,
contentType: 'application/json',
cache: false,
processData: false,
data: payload,
success: function(response){
alert("Resp");
},
error: function(xhr, status, error) {
alert("3-"+xhr.status+" STATUS: "+status+" ERROR: "+error+" URL: "+url);
},
dataType: "json",
beforeSend: function(xhr) {
if (that.proxyUrl !== null) {
xhr.setRequestHeader('SalesforceProxy-Endpoint', url);
}
xhr.setRequestHeader(that.authzHeader, "OAuth " + that开发者_高级运维.sessionId);
xhr.setRequestHeader('X-User-Agent', 'salesforce-toolkit-rest-javascript/' + that.apiVersion);
}
});
}
精彩评论