jQuery AJAX method and Post method

nicholas

Is there any difference between $.post and $.ajax methods in jQuery

$.post("/SPA/Main/SaveEmployee", e).then({
    //code
});

and

$.ajax({
    url: "/Spa/SpaBulkUpload/Upload",
    type: 'POST',
    contentType: false,
    processData: false,
    data: fd
}).then(function (e) {
    //Code
});
Drew Gaynor

The post method is a shorthand method for ajax with type of "POST" as stated in the jQuery documentation. But, you do still need to specify everything else except the type property.

$.post({
    url: "/Spa/SpaBulkUpload/Upload",
    contentType: false,
    processData: false,
    data: fd
}).then(function (e) {
    //Code
});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

jQuery, Convert $.ajax method to $.post

From Dev

jQuery Ajax and POST method in PHP

From Dev

jQuery, ajax POST method success returns: Undefined

From Dev

jQuery ajax POST in Sitecore duplicates method name

From Dev

Ajax JQuery Passing Data to POST method

From Dev

Submit with post method using jquery .ajax()

From Dev

AJAX / jQuery $.get method works, but $.post does not

From Dev

fetch method not posting as expected, compared to jQuery ajax post method

From Dev

Unable to call web method using AJAX post Jquery method

From Dev

POST method in AJAX

From Dev

mistake in ajax method post

From Dev

POST method in AJAX

From Dev

ajax post method error

From Dev

Jquery post method not working

From Dev

How to post data to a controller method with Jquery Ajax that is in an external file?

From Dev

JQuery Ajax POST to Web API returning 405 Method Not Allowed

From Dev

How to send data to post method of node js using AJAX/jQuery?

From Dev

ajax search function using POST method without jquery

From Dev

How to post the viewmodel to action method using JQUERY AJAX in MVC

From Dev

JQuery Ajax POST to Web API returning 405 Method Not Allowed

From Dev

Laravel 5 jQuery ajax post throws a Controller method not found error

From Dev

Jquery.ajax POST call running wrong method supplied

From Dev

Add a parameter to all ajax calls with method POST made with jQuery

From Dev

How to send data to post method of node js using AJAX/jQuery?

From Dev

send mail (mail to php Post method) using Ajax and jQuery

From Dev

Laravel 5.4 - Jquery Ajax Method post does not exist

From Dev

Jquery ajax and controller method

From Dev

jQuery $.ajax() find method

From Dev

Ajax get/post on same method

Related Related

HotTag

Archive