• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

about HttpRequest.send() method

 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.. ?
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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..
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear,

Can you provide some example of Ajax with both methods..

Thanks again.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any basic Ajax tutorial will show you this

GET: foo.com?bar=123;

POST: send("bar=123");

Eric
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic