By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,044 Members | 1,287 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,044 IT Pros & Developers. It's quick & easy.

Problem with XMLHttpRequest.Send('stringdata=foo')

P: n/a
TJO
I am executing the following JavaScript to initiation a post to another
page on my site. I need to retreive the string data being sent in the
..send() method. However, I cannot locate the string anywhere? I am
inspecting the Request object in MyPostPage.aspx is this correct?
Where else should I be looking to get a handle on the 'foo=bar' string?
Thank you in advance.

http_request = new XMLHttpRequest();
http_request.setRequestHeader = 'Content-Type',
'application/x-www-form-urlencoded';
http_request.overrideMimeType('text/xml');
http_request.onreadystatechange = ServerResponseHandler;
http_request.open('POST', 'http://localhost/MyPostPage.aspx', true);
http_request.send('foo=bar')

Jan 19 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
TJO wrote:
I am executing the following JavaScript to initiation a post to another
page on my site. I need to retreive the string data being sent in the
.send() method. However, I cannot locate the string anywhere? I am
inspecting the Request object in MyPostPage.aspx is this correct?
Where else should I be looking to get a handle on the 'foo=bar' string?
Thank you in advance.

http_request = new XMLHttpRequest();
http_request.setRequestHeader = 'Content-Type',
'application/x-www-form-urlencoded';
http_request.overrideMimeType('text/xml'); Why? http_request.onreadystatechange = ServerResponseHandler;
http_request.open('POST', 'http://localhost/MyPostPage.aspx', true);
http_request.send('foo=bar')

Have a look on the wire to make sure the HTTP request is correctly formed.

How you get the value depends on your server environment.

--
Ian Collins.
Jan 20 '06 #2

P: n/a
TJO
Thanks but i am not sure how to go about that one. The code seems
simple enough does anyone else have an idea as to why I cannot locate
the "foo=bar" string in my Request object?

Jan 20 '06 #3

P: n/a
TJO wrote:
I am executing the following JavaScript to initiation a post to another
page on my site. I need to retreive the string data being sent in the
.send() method. However, I cannot locate the string anywhere?
I do not know. Can you? ;-)
I am inspecting the Request object in MyPostPage.aspx is this correct?
It is.
Where else should I be looking to get a handle on the 'foo=bar' string?
[...]
http_request.open('POST', 'http://localhost/MyPostPage.aspx', true);
http_request.send('foo=bar')
Request.Form() // should evaluate to "foo=bar"
Request.Form("foo") // should evaluate to "bar"

<URL:http://msdn.microsoft.com/library/en-us/iissdk/html/ef3a75f3-aaff-4f0e-b52f-3206c0886476.asp>
Thank you in advance.


You're welcome. Please RTFM next time before you post, TIA.
PointedEars
Jan 20 '06 #4

P: n/a
Your setRequestHeader may need to look like this:

http_request.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");

Also, you may not need to use the overrideMimeType.

~Digital~

"TJO" <Ti**********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
I am executing the following JavaScript to initiation a post to another
page on my site. I need to retreive the string data being sent in the
.send() method. However, I cannot locate the string anywhere? I am
inspecting the Request object in MyPostPage.aspx is this correct?
Where else should I be looking to get a handle on the 'foo=bar' string?
Thank you in advance.

http_request = new XMLHttpRequest();
http_request.setRequestHeader = 'Content-Type',
'application/x-www-form-urlencoded';
http_request.overrideMimeType('text/xml');
http_request.onreadystatechange = ServerResponseHandler;
http_request.open('POST', 'http://localhost/MyPostPage.aspx', true);
http_request.send('foo=bar')

Jan 20 '06 #5

P: n/a
rkc
TJO wrote:
Thanks but i am not sure how to go about that one. The code seems
simple enough does anyone else have an idea as to why I cannot locate
the "foo=bar" string in my Request object?


request.form("foo")
Jan 20 '06 #6

P: n/a
TJO wrote:
Thanks but i am not sure how to go about that one. The code seems
simple enough does anyone else have an idea as to why I cannot locate
the "foo=bar" string in my Request object?

What one? Please quote.

--
Ian Collins.
Jan 20 '06 #7

P: n/a
Ian Collins wrote:
TJO wrote:
Thanks but i am not sure how to go about that one. The code seems
simple enough does anyone else have an idea as to why I cannot locate
the "foo=bar" string in my Request object?

What one? Please quote.


Do not feed the troll.
Jan 20 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.