简体   繁体   English

jQuery AJAX方法和Post方法

[英]jQuery AJAX method and Post method

Is there any difference between $.post and $.ajax methods in jQuery jQuery中的$ .post和$ .ajax方法之间有什么区别

$.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
});

The post method is a shorthand method for ajax with type of "POST" as stated in the jQuery documentation . post方法是jQuery文档中所述的类型为"POST" ajax的简写方法。 But, you do still need to specify everything else except the type property. 但是,您仍然需要指定除type属性以外的所有其他内容。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM