时间:2021-07-01 10:21:17 帮助过:36人阅读
- <br><html xmlns="http://www.w3.org/1999/xhtml"> <br><head runat="server"> <br><title>无标题页</title> <br><script type="text/javascript"> <br>function getName(){ <br>var xmlhttp; <br>if(window.XMLHttpRequest){ <br>xmlhttp=new XMLHttpRequest(); <br>}else{ <br>xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); <br>} <br>xmlhttp.onreadystatechange=function(){ <br>if(xmlhttp.readyState==4 && xmlhttp.status==200){ <br>alert("你好:"+xmlhttp.responseText); <br>} <br>} <br>xmlhttp.open("post","Default.aspx?id=gname",true); <br>xmlhttp.send(); <br>} <br></script> <br></head> <br><body> <br><form id="form1" runat="server"> <br><div> <input id="Button1" type="button" value="button" onclick="getName()" /></p> <br> </div> <br></form> <br></body> <br></html> <br> <br>后台代码: <br><span><u></u></span> 代码如下:<pre class="brush:php;toolbar:false layui-box layui-code-view layui-code-notepad"><ol class="layui-code-ol"><li><br>protected void Page_Load(object sender, EventArgs e) <br>{ <br>if (Request["id"]!=null) <br>{ <br>Response.Write("张三"); <br>Response.End(); <br>} <br>} <br> <br>执行结果:如下图 <br></li><li><p><img height="324" alt="" src="https://img.gxlcms.com//Uploads-s/new/2019-09-19-201919/20111228222718440.png" width="481" border="0"></p>下载附件代码 下一次我们看看Jquery是怎么异步请求数据的</li><li> </li><li> </li></ol></pre>