最简单的ajax,$.post()用法

 

 $.post("action.php",{'email':$('#email').val(),'address':$('#address').val()},function(data){
    alert(data);
  }

tips:

  第一个参数:action.php,表示ajax的后台路径,也就是action地址。

  第二个参数:向后台传递的参数,键值对的方式传递。

  递三个参数:回掉函数,data为后台执行的返回结果。

ajax有很多表现形式,$.ajax,$.post,这些都是基于jquery的ajax,还有原生的ajax,写起来相对复杂。有兴趣的同学可阅读相关书籍。

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-09
  • 2022-02-02
  • 2021-07-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2022-01-19
  • 2022-02-13
  • 2022-12-23
  • 2021-08-03
相关资源
相似解决方案