SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Jan 2006
    0 Post(s)
    0 Thread(s)

    Radio buttons using AJAX always giving the same value

    I am using this code using AJAX. The probelm is no matter what choice is selected I always get the result grade=5. Can anyone help me with why this is the case? Thanks, Steven.

    <li><input type="radio" id="grade" name="grade" value="5" accesskey="5">Great</li>
    <li><input type="radio" id="grade" name="grade" value="4" accesskey="4">Good</li>
    <li><input type="radio" id="grade" name="grade" value="3" accesskey="3">OK</li>
    <li><input type="radio" id="grade" name="grade" value="2" accesskey="2">Poor</li>
    <li><input type="radio" id="grade" name="grade" value="1" accesskey="1">Oh, oh</li>
    <li><input type="radio" id="grade" name="grade" value="0" accesskey="0">What is this?</li>
    <li><input value="Study now"
    onClick="getNewTotals();" >


    Now that a grade is entered it should be picked up by this text:

    function createQueryString() {
    var grade= document.getElementById("grade").value;
    var queryString = "grade=" +grade;
    return queryString;


    function getNewTotals() {
    var url = "getUpdatedSales.php";
    url = url + "?dummy=" + new Date().getTime();
    var queryString= createQueryString();"POST", url, true);
    request.onreadystatechange = updatePage;
    request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");


    Why do I always get a result of grade=5?
    Last edited by stevenodonnell; Aug 1, 2006 at 20:37.


Posting Permissions

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