John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Previous Successful JS Code worked, now no more to change popup on success of service request

i just used the same style code on a different service that responds with a 'true' or 'false' and gives back only the error popup (in the following example it always shows: "not_confirmed_pickup.html"):

the 'driver_picked_up2' service:

if(data.response==="true") {
$.mobile.changePage("confirmed_pickup.html", {transition: "pop"});
}
else {
$.mobile.changePage("not_confirmed_pickup.html", {transition: "pop"});
}

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Previous Successful JS Code worked, now no more to change popup on success of service request

well, the 'driver_picked_up2' and 'submit_load2' services are exactly alike in the sense that they both send to the server just one request parameter - an id (which is an int), and the 'UpdateStatus2' service sends to the server several request parameters (which include strings and integers); but all three respond exactly alike (either a 'true' or 'false').

I hope that helps. Let me know, thanks.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Previous Successful JS Code worked, now no more to change popup on success of service request

If in response you get true/false (without quotes) and Data Type in service settings is set to json then in data will be boolean true or false. That's why it's better to use codeif(data) {
$.mobile.changePage("confirmed_pickup.html", {transition: "pop"});
} else {
$.mobile.changePage("not_confirmed_pickup.html", {transition: "pop"});
}/code

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Previous Successful JS Code worked, now no more to change popup on success of service request

well, for 'submit_load2' service this code works now:

if(data==true) {
$.mobile.changePage("load_submitted.html", {transition: "pop"});
}
else {
$.mobile.changePage("load_not_submitted.html", {transition: "pop"});
}

and for 'driver_picked_up2' service this code works now:

if(data==true) {
$.mobile.changePage("confirmed_pickup.html", {transition: "pop"});
}
else {
$.mobile.changePage("not_confirmed_pickup.html", {transition: "pop"});
}
which is strange because they both are sending the same type of request parameter and responding with the same true or false, yet one has == and the other just =

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Previous Successful JS Code worked, now no more to change popup on success of service request

sorry, for 'driver_picked_up2' service this code works now:
if(data=true) {
$.mobile.changePage("confirmed_pickup.html", {transition: "pop"});
}
else {
$.mobile.changePage("not_confirmed_pickup.html", {transition: "pop"});
}

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Previous Successful JS Code worked, now no more to change popup on success of service request

you know what I dont know how i messed this up... I tested it again just to make sure and actually both of them do have two ==

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Previous Successful JS Code worked, now no more to change popup on success of service request

for service 'UpdateStatus2', I'm still having issues... I also tried

if(data=true)
if(data==true)
if(data===true)

and none of those work. Any ideas?

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Previous Successful JS Code worked, now no more to change popup on success of service request

the only difference in this case is that in its request parameters theres several strings an an id (integer), but the response is exactly the same as the other 2 that work: just true or false

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Previous Successful JS Code worked, now no more to change popup on success of service request

Hi Marina, Im so sorry about this but I finally realized why the third service wasnt working... all three of them work now with: if(data==true)

Return to “Issues”