Results 1 to 2 of 2

Thread: Reading AJAX data

  1. #1

    Reading AJAX data

    Hi all,


    I have an AJAX script that pulls a radio group list from PHP. I would like to then read which of those options the user subsequently selects.

    My AJAX script:
    Code:
    function showCharacteristics()
    		{
    		xmlhttp1=new XMLHttpRequest();
    		xmlhttp1.onreadystatechange=function()
    		{
    		if (xmlhttp1.readyState==4 && xmlhttp1.status==200)
    			{
    			document.getElementById("charList").innerHTML=xmlhttp1.responseText;
    			}
    		}
    		xmlhttp1.open("GET","ctrPanelProc.php?selection=getCharacteristics",true);
    		xmlhttp1.send();
    		}
    My PHP script:
    PHP Code:
    $sql "SELECT * FROM characteristic ORDER BY characteristic ASC";
            
    $result mysql_query($sql);
            while(
    $row mysql_fetch_array($result))
                  {
                  echo 
    "<input type='radio' name='charID' value='" $row['characteristicID']
                      . 
    "'/> " $row['characteristic'] . "<br />" ;
                  } 
    I would like to be able to read the 'charID' value the user has selected and pass that to another function. How can I access this value? Thanks!


    cmccully

  2. #2
    Join Date
    Sep 2010
    Location
    India
    Posts
    4
    do you want to get value on ' Onclick' of radio?
    If so then you have to call function on your php page to get value.
    echo "<input type='radio' name='charID' Onclick="your function()" id=charID[] value='" . $row['characteristicID']
    . "'/> " . $row['characteristic'] . "<br />" ;
    Fuction will contain the code

    var val=document.getElemenById('charID').value;

Similar Threads

  1. Specific data search, extraction and delivery tool
    By FOA in forum General Questions
    Replies: 0
    Last Post: 03 Aug 2006, 06:35 AM
  2. Seek Software Solutions: Building, Managing, Refreshing Data Sets
    By bluesky7 in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 09 Feb 2006, 01:06 PM
  3. Data Entry
    By bpo_ccs in forum Tell Us About Yourself
    Replies: 0
    Last Post: 05 Jan 2006, 12:32 AM

Posting Permissions

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