AJAX
AJAX 不是新的编程语言,是实现异步更新的方法
AJAX技术核心 XMLHttpRequest对象(XHR)
AJAX请求:js原生
var xmlhttp;
if(window.XMLHttpRequest){
//针对主流浏览器
xmlhttp= new XMLHttpRequest();
}else{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
};
//向服务器发送请求 true异步 false同步
xmlhttp.open("get",url,true);
xmlhttp.send();//用于post请求
AJAX请求:jquery
$.ajax({
type:"get",
url:url,
async:true //async 异步 sync 同步
data:{},
dataType:"json",
success:function(msg){
},
error:function(){
}
})

浙公网安备 33010602011771号