AJAXdemo_sync.html Async = false
来源:互联网 发布:怎么进入淘宝达人 编辑:程序博客网 时间:2024/05/29 00:30
Async = false
如需使用 async=false,请将 open() 方法中的第三个参数改为 false:
xmlhttp.open("GET","test1.txt",false);
我们不推荐使用 async=false,但是对于一些小型的请求,也是可以的。
请记住,JavaScript 会等到服务器响应就绪才继续执行。如果服务器繁忙或缓慢,应用程序会挂起或停止。
注释:当您使用 async=false 时,请不要编写 onreadystatechange 函数 - 把代码放到 send() 语句后面即可:
xmlhttp.open("GET","test1.txt",false);xmlhttp.send();document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
<html>
<head>
<title> AJAXdemo_sync.html </title>
<meta charset="UTF-8">
<script type="text/javascript">
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
//xmlhttp.open("GET","test1.txt",true);
xmlhttp.open("GET","test1.txt",false);//Async = false
xmlhttp.send();
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
</script>
</head>
<body>
<div id="myDiv"><h3>Let AJAX change this text</h3></div>
<button type="button" onclick="loadXMLDoc()">Change Content</button>
</body>
</html>
- AJAXdemo_sync.html Async = false
- xmlDoc.async="false"
- xmlDoc.async="false";什么意思async
- jQuery AJAX async false
- jquery jsonp async:false 无效
- Ajax请求中的async:false和async:true的差异
- async : false 配置实现异步请求同步
- jquery 采用async:false同步加载数据
- async : false 配置实现异步请求同步
- $.ajax同步/异步(async:false/true)
- ajax async:false/true的作用介绍
- ajax中async true/false的作用
- $.ajax同步/异步(async:false/true)
- 页面 TextBox 中 不能 输入 HTML 标签 ValidateRequest="false"
- Ajax请求中的async:false/true的作用
- ajax ,async: false, 同步和异步的参数
- Ajax请求中的async:false/true的作用
- Ajax请求中的async:false/true的作用
- 让使用了SQLite的.NET应用自适应32位/64位系统
- 使用POI读取xls和xlsx
- 主主+ lvs keepalived 配置文件
- 金蝶二次开发
- [数据结构]One-Dimensional Life Game
- AJAXdemo_sync.html Async = false
- 微信企业号开发:UserAgent
- ICPCCamp 2016 Day 6 - Spb SU and Spb AU Contest(Colored path-dp)
- Foundation框架解析
- static_cast强制转型疑问
- MySQL + KeepAlived + LVS 单点写入主主同步高可用架构
- uva 11584
- C语言实现单链表(不带头结点)的基本操作
- 23.从物理执行的角度透视 spark job