I need to make an ajax request using Cordova in visual studio, and ajax through JQuery. When I do the test through the browser works correctly, but when I do Android test it returns error with "0" stats and no message. What could it 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);
}
});
}