Jump to content

how do i go about, auto refreshing a certain part


divinedesigns1

Recommended Posts

hey, i have create a website, e-commerce website and i ran into a problem, where the chopping cart icon or image doesnt display the total amount of items within the cart once i click the add to cart button

 

how do i go about doing this? i know i have to use ajax to get this done but i have zero experience with ajax

Link to comment
Share on other sites

Create a php file that will produce the result you require, once you have done that use JavaScript to run that file, to retrieve result and by using id ref of element place in location you require. You can just run the php as is, or pass values to it as a GET string to achieve required result.

 

see http://w3schools.invisionzone.com/index.php?showtopic=54581#entry299614 post #10, the php file produces random image, using html img tag which uses src ref from database, it just creates html image tag that is echoed using php, if you require to pass values to php file just add querystring to end of php flle you which to run

xhttp.open("GET", "random_image.php?name1=value1&name2=value2", true);

Then in the php file retrieve values using $_GET[] or filter_input() http://www.w3schools.com/php/func_filter_input.asp and use these in php script

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...