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
https://forums.phpfreaks.com/topic/107511-hehe-php-session-ajax/
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

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)"

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.