Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Aug 2010
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Keep values from last click

    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:
    Code:
    function ajaxget(gameid,oddstype){
    var mygetrequest=new ajaxRequest()
    mygetrequest.onreadystatechange=function(){
    if (mygetrequest.readyState==4){
    if (mygetrequest.status==200 || window.location.href.indexOf("http")==-1){
    document.getElementById("result").innerHTML=mygetrequest.responseText
    }
    else{
    alert("An error has occured making the request")
    }
    }
    }
    
    mygetrequest.open("GET", "oddscompare.php?oddstype="+oddstype+"&gameID="+gameid, true)
    mygetrequest.send(null)
    
    }
    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

  • #2
    New Coder
    Join Date
    Aug 2010
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Solved it with sessions.

  • #3
    New Coder
    Join Date
    Aug 2010
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    New Coder
    Join Date
    Aug 2010
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Since this is actually related to the php file I will post in the php forum instead.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •