JAVASCRIPT JOURNEY DAY 15

#teamtanayejschallenge

CHAPTER 15 : HTTP AND FORMS?

images.jpg

The Hypertext Transfer Protocol, is the mechanism through which data is requested and provided on the World Wide Web.

We know:

Frontend is responsible for capturing the user inputs then validate and send it to the server and also fetch and display the data on browser.

Backend is responsible for storing and retrieving data from the database.

We should remember that frontend should not directly communicate with database for security reasons. They should be able to communicate with each other to share information.

So the http request and response is the secure way to communicate between client and server.

For that http request: should includes following details, 1.physical location

  1. the path (url) for the server 3.http method(GET, PUT, POST, DELETE, PATCH)
  2. payload/data.

Server can decide which type of data they should accept from the frontend(JSON, Binary, etc..)

JavaScript has great modules and methods to make HTTP requests that can be used to send or receive data from a server side resource.

WAYS TO MAKE HTTP REQUESTS:

2da99bc4-0258-479b-9a67-d257ebe10a3d.jpg

1.jpg

FORMS

Forms allow web sites to send user-submitted information in an HTTP request.

A web form consists of any number of input fields grouped in a

tag.

HTML allows several different styles of fields, ranging from simple on/off checkboxes to drop-down menus and fields for text input.

A lot of field types use the input tag. This tag’s type attribute is used to select the field’s style. These are some commonly used input types:

text : A single-line text field password: Same as text but hides the text that is typed checkbox: An on/off switch radio:(Part of) a multiple-choice field file: Allows the user to choose a file from their computer

Forms can put them anywhere in a page. It is not necessary to put it inside form tag only.

It makes DOM look pretty interactive with a tint of JAVASCRIPT.

Happy Learning:-)