JQuery $ .post ();

I have a question about $ .post () in jQuery. general syntax:

jQuery.post( url, [ data ], [ success(data, textStatus, XMLHttpRequest) ], [ dataType ] );

I would appreciate if someone could shed light on what exactly is data, textStatus along with an example, if possible

Thank!

+3
source share
3 answers

data- The response you are returning from the server. It depends on what you specify dataType. If you specify jsonas parameter argument dataType, jQuery will interpret the data received from the server as json.

textStatusgives you information about the answer, like whether it was successful or something bad happened. Possible values :

  • success
  • error
  • notmodified
  • timeout
  • parsererror

success , textStatus success.

parsererror, . , , dataType json, XML, parsererror, error .

+2

http://api.jquery.com/jQuery.post/, .

, XML ​​ MIME. .

+1

Source: https://habr.com/ru/post/1758772/


All Articles