Jump to content

Hehe PHP session AJAX


Recommended Posts

Hey guys,

 

Got a basket on my shop, but when a user hits add to basket I want the basket (iframe) to refresh and the only way I can think of doing this is AJAX. But I'm not sure about sessions and AJAX is there any other way of doing this or can someone help me with the AJAX and sessions.

 

The baskets contents are all stored as session variables so I wouldnt have thought it be this hard to do v.v

Link to comment
Share on other sites

only way I've come up with to work with AJAX and sessions gets a little complex,

 

the idea being post the SESSION ID to the page (run it through an encryption engine of some sort) and then call the session ID and load the values

 

simple concept tedious implementation,

 

if anyone else has a better way I'd love to hear it, as I've been tinkering with ways to implement this for a while

Link to comment
Share on other sites

what i'm doing is i just have a link on the product page and when you click it it calls up a javascript function. then that function uses ajax to load a php page that adds the product to their "basket" (really just a mysql table) then updates the php session to say theres another item in the basket

 

on the link its like onclick="addtobasket(product id number, price)"

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.