Link to home
Start Free TrialLog in
Avatar of blink10
blink10

asked on

trouble with my ajax request....

i have isolated problem down to these lines of code:

its does send anything to comphp.php


var age = document.getElementById('productid').value;
	var wpm = document.getElementById('memberid').value;
	var sex = document.getElementById('message').value;
	var parameters = "age=" + age + "&wpm=" + wpm + "&sex=" + sex;
	mypostrequest.open("POST", "comphp.php", true);
	mypostrequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	mypostrequest.send(parameters);

Open in new window

Avatar of leakim971
leakim971
Flag of Guadeloupe image

work fine : http://jsfiddle.net/kDEL4/

please provide a link to see your page in live
Avatar of blink10
blink10

ASKER

http://www.billsprice.com/com.php


If it works the message at the bottom will change, its not my php either...it worked fine with get and the php file is only printing the number 1 if it works..
replace :
xmlhttp.open("POST","comphp.php",true);
by :
ajaxRequest.open("POST","comphp.php",true);
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of blink10

ASKER

ok why doesnt $pi = $_POST['pi']; pick up the parameters i sent?
you miss : ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
Avatar of blink10

ASKER

opps forgot to set headers, it works now, thanks.
... you missed