Page 4 of 5

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

Posted: Wed Jun 12, 2013 4:52 pm
by Maryna Brodina

Thank you. I'll update.


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

Posted: Wed Jun 12, 2013 5:21 pm
by John Herdean

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"});
}


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

Posted: Wed Jun 12, 2013 5:26 pm
by John Herdean

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.


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

Posted: Wed Jun 12, 2013 5:55 pm
by Maryna Brodina

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


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

Posted: Wed Jun 12, 2013 7:18 pm
by John Herdean

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 =


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

Posted: Wed Jun 12, 2013 7:20 pm
by John Herdean

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"});
}


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

Posted: Wed Jun 12, 2013 7:25 pm
by John Herdean

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 ==


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

Posted: Wed Jun 12, 2013 7:29 pm
by John Herdean

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?


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

Posted: Wed Jun 12, 2013 7:54 pm
by John Herdean

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


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

Posted: Wed Jun 12, 2013 9:10 pm
by John Herdean

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)