2017最新javascript中AJAX用法
- 网页设计
- 关注:6.48K次
javascript中AJAX用法
兼容地获得XMLHttpRequest对象:
var xhr = null; if(ttpRequest){ //非IE浏览器 xhr = ttpRequest; }else if(veXObject){ //IE浏览器 try{ //高版本,受+支持 xhr = new ActiveXObject("TTP"); }catch(e){ try{ // 低版本,msxml2.6以下版本使用 xhr = new ActiveXObject("TTP"); }catch(e){ alert("IE浏览器无法创建ActiveXObject对象!"); } } }
AJAX处理函数:
("POST",url,true); equestHeader("Content-Type","application/x-www-form-urlencoded"); adystatechange=stateChangeHandler; (); //var name="clf"; (name); function stateChangeHandler(){ if(ystate==4&&us==200){ var obj = lementById("targetDiv"); rHTML = onseText; } }
标签:
JavaScript ajax
- 文章版权属于文章作者所有,转载请注明 https://xuezhezhai.com/sjzz/sjzz/2ko01.html