ajax----jQuery篇

解释一下ajax:ajax是一种在不刷新页面的情况下,与服务器交换数据并部分更新页面的技术。(html、js、css、dom)

关于jquery的$(‘#d1’).load方法:;将请求回的数据放到d1中;

$("#id").load("url",{name:"tom"},function(responseTxt,statusTxt,xhr){

 if(statusTxt=="success")
      alert("外部内容加载成功!");
  if(statusTxt=="error")
      alert("Error: "+xhr.status+": "+xhr.statusText);

})

/******************************/

$.get("url",function(data,status){
alert("数据:" + data + " 状态:" + status);
});

/*********常用的ajax方法***************/

$.ajax({

  async:true,//是否异步

  data:{}//向服务器发送de数据

  dataType:text/XML/json/script//服务器返回的数据类型

  type:post/get//提交的方法;

})

来自------前端17号
原文地址:https://www.cnblogs.com/qianduan17/p/5599678.html