I'm developing a mobile application with the cord, in the mobile version there is a BD that is checking if there is any change in the BD online, if there is an update on the mobile phone, follow my code below:
var serviceURL = "http://projeto.websites.net/Verifica/Atualiza";
var parametros = { id: protocolo }
$.ajax({
type: "GET", url: serviceURL, data: parametros, async: false,
complete: function (data) {
console.log(data);
if (data.prazo != meuprazo || data.status != meustatusBD || data.id_Departamento != meunomeDepartamento) {
db.transaction(select, errorCB, null);
function select(tx) {
tx.executeSql('UPDATE ouvidoria11 set prazo = "' + data.prazo + '", status = "' + data.status + '", nomeDepartamento = "' + data.id_Departamento + '" WHERE protocolo="' + protocolo + '"');
}
function errorCB() {
alert("ERROCB");
}
}
}
});
But the value that is returned from date.prazo is as undefined
, I put console.log(data)
to check what was happening and I realized that it is yes getting the values:
Object {readyState: 4, getResponseHeader: function, getAllResponseHeaders:
function, setRequestHeader: function, overrideMimeType: function…}
abort: function ( statusText ) {
always: function () {
complete: function () {
done: function () {
error: function () {
fail: function () {
getAllResponseHeaders: function () {
getResponseHeader: function ( key ) {
overrideMimeType: function ( type ) {
pipe: function ( /* fnDone, fnFail, fnProgress */ ) {
progress: function () {
promise: function ( obj ) {
readyState: 4
responseJSON: Array[1]
0: Object
anexo: null
assunto: null
endereco: null
id: 0
id_departamento: 2
mensagem: null
nomeDepartamento: null
prazo: "Indefinido"
status: "Aguardando"
__proto__: Object
length: 1
__proto__: Array[0]
responseText: "[{"id":0,"assunto":null,"mensagem":null,"endereco":null,"anexo":null,"status":"Aguardando","prazo":"Indefinido","nomeDepartamento":null,"id_departamento":2}]"
setRequestHeader: function ( name, value ) {
state: function () {
status: 200
statusCode: function ( map ) {
statusText: "OK"
success: function () {
then: function ( /* fnDone, fnFail, fnProgress */ ) {
__proto__: Object
Is the way I'm trying to get these values wrong?