Jump to content

simple post request


elexion
 Share

Recommended Posts

hey guys, I'm having some difficulty with this post request...

 function submit_data(par1,par2,par3,par4,par5){var xmlhttp;if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); }else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }xmlhttp.onreadystatechange=function() { console.log('readyState is => ' + xmlhttp.readyState); if (xmlhttp.readyState==4 && xmlhttp.status==200){document.getElementById("span").innerHTML=xmlhttp.responseText;} }xmlhttp.open("POST", "submit_survey.php",true);xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");xmlhttp.send("name="+par1+"lastname="+par2+"street="+par3+"zipcode="+par4+"hometown="+par5);} 

When I go through the process using the google chrome console, the network tab tells me that the file is never called for some weird reason the console log tells me this readyState is => 1test.php:42 readyState is => 4when I hover over the initiator tab it shows me the full URL of test.php and somehow there's a new parameter in front of par1 can anyone spot anything wrong?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...