Tuesday, February 2, 2010

JavaScript - Methods GET vs. POST in HTML forms

Encoding form data into URL is needed by the GET method. The form data is to be appeared within the message body , by the POST method. By specification, GET is used basically for retrieving data where as POST is used for data storing, data updating, ordering a product or even e-mailing.
JavaScript - Methods GET vs. POST in HTML forms 
The GET method in the HTML forms passes the form values by setting the URL.
Eg: If you type the word ‘Hello’ in Google Search, it sets the following URL:
The POST method sends the data to the server without setting the URL:
Eg:
-----------------------------97891525516423
Content-Disposition: form-data; name="username"
aaaa
-----------------------------97891525516423
Content-Disposition: form-data; name="password"
bbbbb12345
-----------------------------97891525516423
Content-Disposition: form-data; name="submit"
Submit
-----------------------------97891525516423--

0 Comments: