We help IT Professionals succeed at work.

Question regarding to $.ajax() with type "POST" vs $.post()

Kinderly Wade
on
141 Views
Last Modified: 2017-04-04
Hi Experts

I came across this scenario which I can do a post with JQuery ajax() or post(). I am not sure which one to use. I read some information from web but I believe the information wasn't correct because the website mentioned that $.post() only has success callback but I believe it has other function from this link: https://api.jquery.com/jquery.post/ which mentioned that "The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callback methods are removed as of jQuery 3.0. You can use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead."

Now I am kind of confused as to which one to use. I will provide some feedback of what I am trying to do perhaps it will be easier to find the correct method for me. I have a login page that will take inputs from users (userID and password). I am trying to post the information to another page which it will validate user's input. If information is correct then it will return something  along the line of success() callback.

Rest of my pages will follow the same post structure. I need some suggestions as to which post should I use. Thanks
Comment
Watch Question

CERTIFIED EXPERT
Distinguished Expert 2017
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2019
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Kinderly Wadeprogrammer

Author

Commented:
Thanks all for the feedback. I will keep them all under $ajax
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2019

Commented:
You are welcome.