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

1 replies
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=xmlht tp.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>
#alert #box #data #result #sending #show #xmlhttpsend
  • Profile picture of the author lovefax89
    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=xmlht tp.responseText;
    var abccc = xmlhttp.responseText;
    alert(abccc);
    }

    alert box is showing many times like 4 to 5 times...
    how can i remove this error
    {{ DiscussionBoard.errors[6928461].message }}

Trending Topics