I'm trying to have some data send to submit.php. The data does submit but it redirects me to the submit.php page. How can I submit this with out changing page?
JS
function submitq() {
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("submitdata").value=xmlhttp.responseText;
}
}
xmlhttp.open("POST",submit.php,true);
xmlhttp.send();
}
Just figured it out.
The form can't have an action of a method because that will redirect it after it is posted.