Jump to content

AJAX POSTs ------/-----> PHP


jarcoal

Recommended Posts

This is probably more of a Javascript problem, but I'm assuming most PHP developers have run into it now and then, so here it goes.

 

I'm trying to post some vars back to my server with AJAX.  I'm using this code to transmit back to the server:

 

	theMessenger.open("POST", postPage, true); 
	theMessenger.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
	theMessenger.setRequestHeader("Content-Length", theParameters.length);
	theMessenger.setRequestHeader("Connection", "close");
	theMessenger.send(theParameters);

 

From the client's point of view, it appears that the post went off with out a hitch, but the server is unable to interpret the variables.  I can tell the server is getting the request, but the variables don't pass.  I am assuming this is an encoding problem, as I've seen many tutorials that include encodeURI/encodeComponentURI.  However I don't understand when those are required (just the variable values, or the &'s and ='s found in a parameter string?).

 

Any help would be very appreciated.

Link to comment
https://forums.phpfreaks.com/topic/104292-ajax-posts-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.