0
I need to make an ajax request using Cordova in visual studio, and ajax through Jquery. When I test through the browser works correctly, but when I test Android it returns error with stauts "0" and no message. What could be?
function teste_login(cpf, password) {
var cpfSenha = { cpf: cpf, senha: password };
var retornoObj;
cpfSenha = JSON.stringify(cpfSenha);
$.ajax({
url: 'http://url-arquivo.php',
type: 'POST',
crossDomain: true,
data: cpfSenha,
dataType: 'html',
success: function (msgJson) {
retornoObj = JSON.parse(msgJson.replace(/ +(?![\. }])/g, ''));
if (retornoObj.sucesso == true) {
window.location.href = "principal.html";
}
},
error: function (xhr, thrownError) {
alert(xhr.status);
alert(xhr.responseText);
alert(thrownError);
}
});
}