Imagine that you have a form on a HTML page and clicking the "submit" button sends the data in the form back to the server, as "name=value" pairs.
- GET method:
1.All the name value pairs are submitted as a query string in URL.
2.It's not secured as it is visible in plain text format in the Location bar of the web browser.
3.As the data transfers through address bar (URL) there are some restrictions in using space, some characters like ampersand (&) etc in the GET method of posting data.
4.Length of the string is restricted.
5.If method is not mentioned in the Form tag, this is the default method used.
6.If get method is used and if the page is refreshed it would not prompt before the request is submitted again.
7.One can store the name value pairs as bookmark and directly be used while sharing with others - example search results.
Data is always submitted in the form of text
8.If the response of the page is always same for the posted query then use GET example database searches
- POST method:
1.All the name value pairs are submitted in the Message body of request.
2.Length of the string(data submitted) is not restricted.
3.It is secure because name value pairs not seen on the address bar
4.If post method is used and if the page is refreshed it would prompt before the request is submitted again.
5.If the request involves a form with side effects(ie.database changes) then use post method.
cheers,
@Varaprasad!!!
No comments:
Post a Comment