last day (14 days later) » 

8:30 AM
0
Q: Using Cookies to transfer JSON data between 2 web pages

Rukshan HassimSo I've been trying to do this for more than a day now. I'm getting a few user inputs through a form (ex - a name of a car), then I search through a JSON file to see whether its available. After this I'm trying to send the results of the search to a results page. I've been trying to use a cookie ...

 
you are storing as carResults and retrieving as searchResults?
 
ahh that was a typo, its actually not there in the original code
 
And parsing str instead of temp? check the errors first.
 
ahh i was rushing last time so bad, its fixed now i guess. Sorry for the typos
 
Still you have errors in your code, may be typos, So what is the issue you are actually facing here?
 
8:30 AM
The problem is I dont get any output in the result.html. I cross checked the searching part by alerting the results and it worked. I'm sure that I'm doing something wrong in the cookie part.
I hope im not bothering you here with the chat Mr. Jyothi
I just found out after a few typo fixing the code works
but now the problem is that theres always only one output
there is supposed to be more
 
Just console log for result before appending
 
i will try that out
 
9:01 AM
okay i think i found the problem
$.getJSON("properties.json", function (data) {
$(data.cars).each(function (index, value) {
if (value.name == name) {
cars.push(value);
}
});

if (cars.length > 0) {
send(cars);
} else {
// do some handling
}
});
in here the send function is called after only one vehicle is found
why does that happen
found the error
thank you so much for helping me out
 
(y)
Happy coding
 
actually the error was me using "new Array()"
 
cheers bro :)
 
wow js just wow :'D
ahaha cheers mate
 

last day (14 days later) »