行使jQuery简化ajax操纵的实例代码
发布时间:2018-08-20 19:16:21 所属栏目:业界 来源:站长网
导读:行使 jQuery 简化ajax操纵的实例代码 Copy to Clipboard 引用的内容:[www.veryhuo.com]%@ Page Language=C# ContentType=text/html ResponseEncoding=gb2312% script runat=server protected void Page_Load(object sender, EventArgs e) { if (!IsPostBa
行使jQuery简化ajax操纵的实例代码 Copy to Clipboard![]() <script runat="server"> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.Form["name"] != null) { System.Threading.Thread.Sleep(3000); Response.Write(Request.Form["name"] + ":你好,异步通讯数据传输乐成!"); Response.End(); } } } </script> <html> <head runat="server"> <title>Untitled Page</title> <style type="text/css"> body{font-size:12px; line-height:30px;} </style> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> //提交数据 function ajax(){ $.post( "index.aspx", { name:"尊敬的伴侣" }, function(data){ $("#divData").text(data); } ) } $(document).ready(function(){ //开始哀求 $("#jindu").ajaxStart(function(){ $("#divData").html(null); $(this).show(); }); //哀求竣事时 $("#jindu").ajaxStop(function(){ $(this).hide(); }); }); </script> </head> <body> <input id="Button1" type="button" value="异步通讯测试" onclick="ajax();" /> <div id="divData"></div> <div id="jindu" style="display:none;">数据正在提交,请稍后…</div> </body> </html> (编辑:湖南网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
站长推荐
热点阅读