jQuery中ajax请求有三种操作方式$.get() $.post() $.ajax()
get和post(是对$.ajax的封装)
//不传递数据 $.get("./16.php",function(msg){ alert(msg); }); //给服务器传递数据 $.get("./16.php",{name:‘tom‘,age:23},function(msg){ alert(msg); }); //用法与get方法类似 $.post("./16.php",{},function(){});
$.ajax是jQuery底层的ajax方法
$.ajax({ url:"./16.php", data:"name=tom&addr=beijing&age=23", dataType:‘text‘, async:false, type:‘post‘, success:function(msg){ //ajax请求成功后要执行这个的代码 alert(msg); } });
jQuery封装的ajax操作,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/zixueit/p/3855227.html