HTTP: For client-server communication, there are some sets of rules, from which we have one rule 'HTTP'. The hypertext transfer protocol (HTTP) has been designed to communicate between the client(Browser) and server. Example: A client (browser) sends an HTTP request to the server and the server returns a response to the client. The response contains information about the request and may also contain the requested content.
HTTP Methods: There are different methods for sending a hypertext to the server. Each method defines, how will be handling, the submission of particular data by the server. HTTP Methods: GET, POST, PUT, HEAD, DELETE, PATCH, OPTIONS, CONNECT, TRACE
But, HTML supports only 'get' and 'post' methods.
GET Method of HTTP: If we set the 'GET' method then First of all, our data feed into the URL and then goes to the server.
Some notes on GET requests:
GET requests can be cached
GET requests to remain in the browser history
GET requests can be bookmarked
GET requests should not use when dealing with sensitive data
GET requests have length restrictions
GET requests are only used to request data (not modify).
POST Method of HTTP: If we set the 'POST' method then the Body request exists in the place of the URL. For implementing this method we have an 'action' attribute. In this attribute, we provide a part/component of the URL (called route) which helps the server for handling the particular submission request because the server has lots of requests at one time. For example: If we want to submit a signup form we add action="/signup"
attribute.
Some notes on POST requests:
POST requests are never cached
POST requests do not remain in the browser history
POST requests cannot be bookmarked
POST requests have no restrictions on data length.