ajax(Asynchronous JavaScript and XML) 异步js或者xml

1.XMLHttpRequest 对象:向服务器发送局部的请求,异步获取执行

  a.浏览器支持

  b.语法:

    xmlhttp==new XMLHttpRequest();

    xmlhttp.open("GET","test1.txt",true);# open(method,url,async

    xmlhttp.send();

    #异步执行,当服务器完成状态了,在客户端调用该函数

    xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } }


2.django中ajax:
  在views中使用request.is_ajax()判断是否为ajax请求
posted @ 2015-08-26 11:29  雅思敏  阅读(233)  评论(0编辑  收藏  举报