Technology

Jquery :Just know more about the http before using any ajax operation

Safe and Idempotent Methods

Safe:
users should be safe and should be aware of any action he takes which may have an unexpected significance to himself or others
i.e GET , HEAD only perform a get requesti.e retrieve

Idempotent Methods :


Clients will do n>0 requests i.e clients will make multiple requests while getting the same output
Clients can make that same call repeatedly while producing the same result.
Making multiple identical requests has the same effect as making a single request. Idempotent operations produce the same result on the server (no side effects), the response itself may not be the same (e.g. a resource’s state may change between requests).

eg. PUT and DELETE

But Delete returns 200(OK)
204(No Content)
4o4(Not Found)

once deleted and then again performing deletion will give 404 but the state on the server is the same.

GET:


It will get the output after reading the URL and now will be the same for the entire operation.
Conditional Get :-
If-Modified-Since,
If-Unmodified-Since,
If-Match,
If-None-Match,
or If-Range header field.

POST:

  • Annotation of existing resources;
    • Posting a message to a bulletin board, newsgroup, mailing list,
      or similar group of articles;
    • Providing a block of data, such as the result of submitting a
      form, to a data-handling process;
    • Extending a database through an append operation.

The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server.

If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI.

If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response.
If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to indicate successful completion of the request.
If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be given that reflects the nature of the problem.

PUT AND POST DIFFERENCE :

putting a resource twice no effects by using PUT while POST is not idempotent

put works as specific while POST work as abstract

We can create or update a resource using PUT and then can make the same call, again, and again, the resource is still there with the same state as it did with the first call while PUT makes two identical post requests will most result in two resources containing the same information.

if we name URL objects we create explicitly, or let the server decide? If you name them then use PUT. If you let the server decide then use POST

Jquery, it’s time to master, but how much?

Tags: Jquery
Ankit

Leave a Comment

View Comments

  • Thanks in support of sharing such a pleasant opinion, paragraph is nice,
    thats why i have read it completely

  • Amazing blog! Is your theme custom made or did you download it from somewhere?
    A design like yours with a few simple tweeks would really make my blog jump out.
    Please let me know where you got your design. Many
    thanks

    • Thank you! It comes prebuilt but you need to customize it, how you would like to display it out. Our team will be delighted if we can aid you.Thank you.

Recent Posts

The Rise of Corporate Event Companies in Mumbai

Mumbai, often referred to as the financial capital of India, is a hub for businesses and industries. With countless corporate…

2 weeks ago

The Ultimate Guide to Choosing the Best Security Company in Noida

When it comes to security services in Noida, there are several reputable companies that cater to various needs. Let me…

1 year ago

Steel Bite Pro: The Revolutionary Supplement Transforming Oral Health Forever

Are you tired of dealing with tooth decay, gum problems, and expensive dental treatments? Look no further! Steel Bite Pro…

1 year ago

Captivating Elegance: Unveiling the Beauty of Oval Moissanite Rings

In the world of fine jewelry, oval moissanite rings have emerged as a captivating choice for those seeking elegance and…

1 year ago

Top 10 Digital Marketing Agency In Noida

Noida, located in the state of Uttar Pradesh, is a fast-growing hub of digital marketing agencies in India. Choosing the…

2 years ago

Two-Wheeled Thrills: The Ultimate Guide to the Latest Bikes in India 2023

As we move into 2023, the world of motorcycles in India is set to see some exciting changes. Manufacturers are…

2 years ago