Hi,
I am trying to use a XMLHttp POST to send data to an asp page on a website, using the following code :
Although the asp page receives and processes the data, the space is missing from the name value.
I tested the asp code by creating a standard HTML form and POSTing from that. This time the name was saved with white space preserved.
I have had the asp write back the entire contents of the POST and also the request.form("name") and got the following results:
XMLHttp:
response.write(Request.Form) > name=Fred Flintstone
response.write(Request.Form("name")) > FredFlintstone
Standard Http form:
response.write(Request.Form) > name=Fred+Flintstone
response.write(Request.Form("name")) > Fred Flintstone
From the above test it would appear that the url encoding is not working properly when sending the XMLHttp request.
Has anybody come across this before, or can spot something wrong with the code?
Many thanks
Darren
I am trying to use a XMLHttp POST to send data to an asp page on a website, using the following code :
Code:
var xmlhttp;
if (window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}
else
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("POST","[URL unfurl="true"]http://www.company.co.uk/quiz.asp",false);[/URL]
xmlhttp.setRequestHeader("Content-Type", "application/x-[URL unfurl="true"]www-form-urlencoded");[/URL]
xmlhttp.send("name=Fred Flintstone");
Although the asp page receives and processes the data, the space is missing from the name value.
I tested the asp code by creating a standard HTML form and POSTing from that. This time the name was saved with white space preserved.
I have had the asp write back the entire contents of the POST and also the request.form("name") and got the following results:
XMLHttp:
response.write(Request.Form) > name=Fred Flintstone
response.write(Request.Form("name")) > FredFlintstone
Standard Http form:
response.write(Request.Form) > name=Fred+Flintstone
response.write(Request.Form("name")) > Fred Flintstone
From the above test it would appear that the url encoding is not working properly when sending the XMLHttp request.
Has anybody come across this before, or can spot something wrong with the code?
Many thanks
Darren