0
votes

I have seen many articles for making ajax requests..

most of them are using $.AJAX for jquery ajax posting and some of them are using $.POST for jquery ajax posting...

I want to know what is the best way if I want to post using ajax? which method makes the ajax request fast and in lightweight?

3
$.post is short-hand method for equivalent $.ajax that is set up for POST. They won't have any difference.nhahtdh
@nhahtdh- Yes I realized, thank you very much....Naveen Gamage

3 Answers

2
votes

$.post is a shorthand way of using $.ajax for POST requests, so no difference.

$.ajax is generally better to use if you need some advanced configuration.

1
votes

$.post is just shorthand for $.ajax({type: 'POST'}). It makes no difference to the speed or weight of the request, just changes the readability of your code.

1
votes

$.post is just a shorthand for $.ajax({ type: 'POST' }) [see reference], so there is no acceptable performance improvement, but still a readability one.