[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

trouble with my ajax request....

Posted on 2011-10-07
8
Medium Priority
?
312 Views
Last Modified: 2012-06-27
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

0
Comment
Question by:blink10
  • 5
  • 3
8 Comments
 
LVL 83

Expert Comment

by:leakim971
ID: 36932907
work fine : http://jsfiddle.net/kDEL4/

please provide a link to see your page in live
0
 

Author Comment

by:blink10
ID: 36932931
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..
0
 
LVL 83

Expert Comment

by:leakim971
ID: 36932953
replace :
xmlhttp.open("POST","comphp.php",true);
by :
ajaxRequest.open("POST","comphp.php",true);
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 36932962
next line too :
xmlhttp.send(parameters)
by :
ajaxRequest.send(parameters)
0
 

Author Comment

by:blink10
ID: 36933999
ok why doesnt $pi = $_POST['pi']; pick up the parameters i sent?
0
 
LVL 83

Expert Comment

by:leakim971
ID: 36934033
you miss : ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
0
 

Author Closing Comment

by:blink10
ID: 36934034
opps forgot to set headers, it works now, thanks.
0
 
LVL 83

Expert Comment

by:leakim971
ID: 36934035
... you missed
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question