View Full Version : Keep values from last click

11-16-2010, 09:30 PM
Well, I have made a script that gets values from a php file when I click on a link. Each time I click one of the links it gets new data.

What I want is to keep the data from my previous clicks in the div I'm sending the info to. On the side of each result I will add a "delete button" if I do want to remove the result.

Here is the script I have so far:

function ajaxget(gameid,oddstype){
var mygetrequest=new ajaxRequest()
if (mygetrequest.readyState==4){
if (mygetrequest.status==200 || window.location.href.indexOf("http")==-1){
alert("An error has occured making the request")

mygetrequest.open("GET", "oddscompare.php?oddstype="+oddstype+"&gameID="+gameid, true)


The script can be seen in action here: http://cjhweb.se/Oddstest/oddstest2.php

Try clicking the small "+" buttons to see what I mean.

Happy for any help :)

11-17-2010, 04:52 PM
Solved it with sessions.

11-17-2010, 06:49 PM
Well, I noticed a bug. When I just choose the odds (1) for each games there are no problems but if I choose (X) from one game all other games in the list gets (X) also. Anyone have some suggestion? Just need to understand the logic behind this so I know what I am doing wrong.

Here is the testpage: http://cjhweb.se/Oddstest/oddstest2.php

Click one of the + pictures to see what I mean.

11-17-2010, 06:59 PM
Since this is actually related to the php file I will post in the php forum instead.