229 posts
  • Copyright Ninja
  • Top Monthly Author
  • Trendsetter
  • Weekly Top Seller
+8 more
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
  • 5 Years of Membership
  • Affiliate Level 1
  • Author Level 5
  • Collector Level 2
+3 more
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?

229 posts
  • Copyright Ninja
  • Top Monthly Author
  • Trendsetter
  • Weekly Top Seller
+8 more
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
  • 5 Years of Membership
  • Affiliate Level 1
  • Author Level 5
  • Collector Level 2
+3 more
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.

229 posts
  • Copyright Ninja
  • Top Monthly Author
  • Trendsetter
  • Weekly Top Seller
+8 more
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
  • 5 Years of Membership
  • Affiliate Level 1
  • Author Level 5
  • Collector Level 2
+3 more
ATLChris
says

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

2952 posts
  • 6 Years of Membership
  • Affiliate Level 5
  • Author Level 8
  • Bundle Boss
+12 more
DDStudios
says

Get a room guys ! :P

229 posts
  • Copyright Ninja
  • Top Monthly Author
  • Trendsetter
  • Weekly Top Seller
+8 more
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!

229 posts
  • Copyright Ninja
  • Top Monthly Author
  • Trendsetter
  • Weekly Top Seller
+8 more
simonbouchard
says
Get a room guys ! :P

GNA !!!!

by
by
by
by
by
by