SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2011
    Location
    zziapex.com
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    show result in alert box after sending data using xmlhttp.send()

    Hello

    I am making rating system and i wanna send value using xmlhttp.send(); and i wanna show my final result in alert box please help me this is my code

    system work like this

    first user click on this

    <a href="javascript: void(0)" title="1 star out of 10" class="one-star" onclick="return one()" onfocus="rating_submit(1)">1</a>

    this is my function

    <script type="text/javascript">
    function rating_submit(str)
    {
    if (str=="")
    {
    document.getElementById("ajaxuse").innerHTML="";
    return;
    }
    if (window.XMLHttpRequest)
    {
    xmlhttp=new XMLHttpRequest();
    }
    else
    {
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function()
    {
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("ajaxuse").innerHTML=xmlhttp.responseText;
    }
    }

    xmlhttp.open("GET","rating.php?films=<?php echo $$films; ?>&film_name=<?php echo $film_name; ?>&film_id=<?php echo $film_id; ?>&username=<?php echo $username; ?>&rating="+str,true);
    xmlhttp.send();
    }
    </script>

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2011
    Location
    zziapex.com
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    now i solve half of this problem by myself but one small appearing again

    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    //document.getElementById("ajaxuse").innerHTML=xmlhttp.responseText;
    var abccc = xmlhttp.responseText;
    alert(abccc);
    }

    alert box is showing many times like 4 to 5 times...
    how can i remove this error


Bookmarks

Posting Permissions

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