原文:http://www.cnblogs.com/chenwolong/p/Get.html

//无参数请求-简单示例
$(document).ready(function () {
$.ajax({
url: "http://localhost:9953/api/Person/Get",
type: "post",
contentType: "application/json",
dataType: "text",
data:{},
success: function (result,status) {
if (status == "success") {
alert(result);
}
},
error: function (error) {
alert(error);
}
});
});
//单个参数传递- data: {"":"3"}, 这种方式也竟然正确
$(document).ready(function (data) {
$.ajax({
url: "http://localhost:9953/api/Person/GetById",
type: "post",
contentType: "application/json",
dataType: "text",
data: {Id:"3"},
success: function (result,status) {
alert(result)
},
error: function (error) {
alert(error);
}
});
});

 

Ajax往后台传参数,无参数,一个参数,多个参数,一个对象等

Ajax往后台传参数,无参数,一个参数,多个参数,一个对象等

Ajax往后台传参数,无参数,一个参数,多个参数,一个对象等

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2022-12-23
  • 2021-11-06
相关资源
相似解决方案