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

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

Spread the love

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?

2020-01-08

6 Comments

  1. 20 Important ASP.NET MVC Interview Questions - TenOClocks
  2. Jquery, it's time to master, but how much? - TenOClocks
    1. Thank you so much for your valuable feedback..

  3. 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

    1. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *