ClassNotes JS13
ClassNotes JS13
e
The Fetch API provides an interface for fetching (sending/receiving) resources.
lleg
o
It uses Request and Response objects.
na C
The fetch() method is used to fetch a resource (data).
Ap
let promise = fetch( url , [options] )
agar koi bhi options nhi die to wo ek get request ko fetch karta
hai.jab bas data receive krna h data ko kuch bhejna nahi hai
Understanding Terms
e
network ko kch request bhej rhe aur kuch response aa rha that is
AJAX is Asynchronous JS & XML
g
using ajax
olle
JSON is JavaScript Object Notation
na C
p
json() method : returns a second promise that resolves with the result of parsing the
A
response body text as JSON. (Input is JSON, output is JS object)
e
HTTP Verbs
g
Hypertext Transfer Protocol
olle
C
Http response status codes . various types
a
of errors 404 500 etc. on mdn docx
Apn
*HTTP response headers also contain details about the
responses, such as content type, HTTP status code etc.
header contains some addn info jo
shyd response ke sath aa rhi hai
e
Sending POST Request
lleg
Co
fetch(url,options)
pna
A