$.post()方法是jquery本身对ajax的一个简单封装,其效果等价于:

 $.ajax({

    url:url,

    data:data,

    dataType:dataType,

    success:function(data){

    //success 

    }

  });

$.post()函数有四个参数:URL、data、success、dataType,分别是

  URL:请求的路径,对应ajax中的url

  data:请求数据(可选)

  success:请求成功之后执行的函数(可选)

  dataType:请求成功之后返回的数据类型(可选)

如下例子:

  $.post("/loginController/login","id=1",function(data){

    //返回的JSON数据

  },"json")

相关文章:

  • 2021-11-24
  • 2022-01-21
  • 2021-09-02
  • 2022-12-23
  • 2022-12-23
  • 2021-05-12
猜你喜欢
  • 2021-09-09
  • 2021-06-07
  • 2022-02-07
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案