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

how to pass data from an incoming json response to local storage, then back to my server?

Hi Katya, i did try your method at first and then i went with the local storage method because Im assumimg im getting a false response from my server. My server sends a false responds when it doesnt receive a valid driver_id. Now, I went back to your mapping method and i reviewed my database. It does write a new record to the DB even with the correct driver_id in the DB.

Next thing i did is delete that error popup from the JS i wrote that attached to the submit_load2 service on success action (invoke JS). Originally, the JS was written like this (and it worked fine when i had the static list in the select menu):

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

So, naturally since my 1st test with the static list (in the select menu) worked fine I assumed the same code above would also work. Then, what I did just to see if i even get the 'load_submitted' popup to come up, i rewrote the code like this:

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

As you can see, all available options point only to 'load_submitted' -- how is it even possible with the last code i still end up with 'load_not_submitted'??

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

how to pass data from an incoming json response to local storage, then back to my server?

in sum, my database is receiving the record just fine -- it must be returning a true because theres no way possible it can write a record with a false response back to appery. SO, now we dont have an issue with sending back to the server correct info, we have an issue with the last set of code. Or I have no idea how its even possible it goes to 'load_not_submitted' popup...

My programmer friend will be here very soon and we will investigate further on the server side if in fact everything is coming in fine. But so far, I see the records are being added successfully.

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

how to pass data from an incoming json response to local storage, then back to my server?

sorry Max, i did not yet. it seems there another bigger problem I need your guys help on right now to figure out how in the world this 'load_not_submitted' popup keeps coming up even though i stopped calling it... I will try later. Please, lets fix this problem first..

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

how to pass data from an incoming json response to local storage, then back to my server?

we have determined that our server is correctly adding a new record, and the way our code is written in the specified controller is that it cannot add a new record if it does not return a true response back to Appery. Therefore as i mentioned yesterday, there must be something wrong with the JS i wrote that attached to the submit_load2 service on success action (invoke JS).

Are you guys researching this issue?

Because i just tried to do a live test and now I cant even get into that page... With any variation JS code:

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

OR SOMETHING LIKE THIS:

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

Yesterday, at least I was able to get in the page and hit the submit load button, but now I cant even get in (see below):
Please let me know whats going on with these codes?? Or, how to fix this problem. Thanks

Image

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

how to pass data from an incoming json response to local storage, then back to my server?

I dont now what kind of format this project is, its a zip file - and theres an xml file there and 3 other files im not sure of.. Anywayz, which program do i use to run it?

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

how to pass data from an incoming json response to local storage, then back to my server?

ok, well Im assuming you guys are working on trying to figure the problem out and I will be waiting for a resolution on this problem. Thanks.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

how to pass data from an incoming json response to local storage, then back to my server?

Hello John,

Do you have any errors on browser console, when you try to load the page?

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

how to pass data from an incoming json response to local storage, then back to my server?

sorry, i should've ran the console before.

Yes in fact there are errors. you can also check the live test here:

http://appery.io/app/mobile-frame?src...

go to disptach login Log In assign load

Below is a snapshot what the error is:

Image

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

how to pass data from an incoming json response to local storage, then back to my server?

This is a brand new error because as of yesterday, I didnt change a single thing and it worked fine getting inside the page expect for the fact that it was popping up a popup screen that wasnt even being called in the JS. It looks like you guys have been doing something on your side regarding this JS code.

1st it was calling up a popup that wasnt even possible (meaning my server response was a true) - when true it needs to pop up 'load_submitted' (but it kept on calling up 'load_not_submitted' even when the my server response was a true)

2nd, i rewrote the JS code and removed any reference to 'load_not_submitted' and still called up 'load_not_submitted'

Then, i just deleted that JS code all together and just navigated to 'load_submitted' on Complete. At that point it finally went to 'load_submitted'

I hope you guys figure this out because I really do need it to work on Success and tell it to go to 'load_submitted' when server response is true, and when the server response is false - it must go to 'load_not_submitted'

I will be using the JS code structure in many more places in my projects, so its very important to me that we make this work perfectly. Once we get this working perfect, I will not need to bug you guys in the future regarding this kind of functionality.

Thanks Guys.

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

how to pass data from an incoming json response to local storage, then back to my server?

BTW Igor, you are the first person to teach me this JS code. And When I implemented it the very first time many days ago it worked fine. At that point the only difference from this situation is that I originally had the select menu options static (meaning I wrote in the options - values and labels directly inside the select menu).

Now, I'm getting a list of driver names with Id's that populate the select menu on arrival of assign_load page.

Return to “Issues”