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

AJAXJavaScript

Avatar of undefined
Last Comment
leakim971
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..
Avatar of leakim971
leakim971
Flag of Guadeloupe image

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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of blink10
blink10

ASKER

ok why doesnt $pi = $_POST['pi']; pick up the parameters i sent?
Avatar of leakim971
leakim971
Flag of Guadeloupe image

you miss : ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
Avatar of blink10
blink10

ASKER

opps forgot to set headers, it works now, thanks.
Avatar of leakim971
leakim971
Flag of Guadeloupe image

... you missed
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo