| Author |
about HttpRequest.send() method
|
Muhammad Saifuddin
Ranch Hand
Joined: Dec 06, 2005
Posts: 1291
|
|
hi ranchers, I have seen some of example of Ajax on web but i found the same thing in HttpRequest.send method specify by "null" what does it mean by specified null value. What the server understand by this.. ?
|
Saifuddin..
[Linkedin] How To Ask Questions On JavaRanch My OpenSource
|
 |
Jaikiran Pai
Saloon Keeper
Joined: Jul 20, 2005
Posts: 6717
|
|
|
The XmlHttpRequest that you create can be of 2 types - "GET" or "POST". In case the request is of type GET then you pass null through the send() method. However in case the request is of type POST then you can pass the data that has to be sent to the server through the parameter of send() method.
|
[My Blog] [JavaRanch Journal]
|
 |
Muhammad Saifuddin
Ranch Hand
Joined: Dec 06, 2005
Posts: 1291
|
|
Originally posted by Jaikiran Pai: In case the request is of type GET then you pass null through the send() method. However in case the request is of type POST then you can pass the data that has to be sent to the server through the parameter of send() method.
Thanks for the response. your response bit clear to me about these 2 methods but what i am looking for the concept behind sending a null value with GET method or why sending data with POST in send() method ? Please make me more clear on this. Thanks in Advance..
|
 |
Bear Bibeault
Author and opinionated walrus
Marshal
Joined: Jan 10, 2002
Posts: 50680
|
|
The distinction lies in the difference between how request parameters are passed in HTTP GET methods vs. HTTP POST methods. In a GET, the parameters are passed as part of the URL in the query string. In a POST, the parameters are passed in the request body. Ajax, being built on top of HTTP, must follow the rules on constructing HTTP requests.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Muhammad Saifuddin
Ranch Hand
Joined: Dec 06, 2005
Posts: 1291
|
|
Thanks Bear, Can you provide some example of Ajax with both methods.. Thanks again.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15003
|
|
Any basic Ajax tutorial will show you this GET: foo.com?bar=123; POST: send("bar=123"); Eric
|
 |
 |
|
|
subject: about HttpRequest.send() method
|
|
|