218 posts
  • Canada
  • Elite Author
  • Exclusive Author
  • Bought between 100 and 499 items
  • Has been a member for 6-7 years
  • Referred between 100 and 199 users
  • Sold between 250 000 and 1 000 000 dollars
simonbouchard says

Hello,

I downloaded a very old free weather jQuery script. It is working fine, I’ve redesigned it a little bit but the jQuery code is pretty ugly and it miss something very important, cookies support!

It’s simple, we got a form where you enter your city and click “search”. It connect with Google Weather’s API and when the data is found the form fade out and the weather’s data fade in (Date, City, Wheater Icon, Temperature).

The Problem : each time I refresh the page, the data is loss. I need to store the visitor’s city in a cookie. (Edit: Or in the DOM ?)

Someone here can help with that ?

242 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
  • Sold between 10 000 and 50 000 dollars
  • United States
ATLChris says

Do you want to store it in a cookie for so they can return to the site and have it remembered or just save it in the session to it remembers their Zip during the session?

218 posts
  • Canada
  • Elite Author
  • Exclusive Author
  • Bought between 100 and 499 items
  • Has been a member for 6-7 years
  • Referred between 100 and 199 users
  • Sold between 250 000 and 1 000 000 dollars
simonbouchard says
Do you want to store it in a cookie for so they can return to the site and have it remembered or just save it in the session to it remembers their Zip during the session?

Sesssion is good, cookie is better for my situation, but both are welcome.

242 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
  • Sold between 10 000 and 50 000 dollars
  • United States
ATLChris says

I was going to say you could use PHP to load the zip as a session varible when entered then have the jQuery script grab the session variable from php if it exist. That is what I would do, but I am not a jQuery expert.

218 posts
  • Canada
  • Elite Author
  • Exclusive Author
  • Bought between 100 and 499 items
  • Has been a member for 6-7 years
  • Referred between 100 and 199 users
  • Sold between 250 000 and 1 000 000 dollars
simonbouchard says
I was going to say you could use PHP to load the zip as a session varible when entered then have the jQuery script grab the session variable from php if it exist. That is what I would do, but I am not a jQuery expert.

This script use PHP to query Google’s API

header("content-type: text/xml"); $where = $_GET['where']; $xmlData = file_get_contents("http://www.google.com/ig/api?weather=$where"); echo $xmlData;
242 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
  • Sold between 10 000 and 50 000 dollars
  • United States
ATLChris says

paste the implementation code of the script. How is the zip sent to the script? Post?

2952 posts
  • Attended a Community Meetup
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Bought between 100 and 499 items
  • Contributed a Blog Post
  • Elite Author
  • Exclusive Author
+5 more
DDStudios says

Get a room guys ! :P

218 posts
  • Canada
  • Elite Author
  • Exclusive Author
  • Bought between 100 and 499 items
  • Has been a member for 6-7 years
  • Referred between 100 and 199 users
  • Sold between 250 000 and 1 000 000 dollars
simonbouchard says
paste the implementation code of the script. How is the zip sent to the script? Post?

Send me an email, I’ll send you the script or the URL of my dev environment.

Thank you Chris for your time!

218 posts
  • Canada
  • Elite Author
  • Exclusive Author
  • Bought between 100 and 499 items
  • Has been a member for 6-7 years
  • Referred between 100 and 199 users
  • Sold between 250 000 and 1 000 000 dollars
simonbouchard says
Get a room guys ! :P

GNA !!!!

by
by
by
by
by
by