4
I am developing a mobile application with Cordova, in the mobile version there is a BD that keeps checking if there is any change in online BD, if there is it updates in mobile follows below my code:
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");
}
}
}
});
However the value that is returned from date.term is as undefined
, put a console.log(data)
to check what was happening and realized that he is yes receiving 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
It’s wrong the way I’m trying to receive these values?
You don’t want to use
success
instead ofcomplete
?– Sergio
You managed to solve this problem?
– Sergio