日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

JqueryAjax异步加载在ASP.NET

發(fā)布時間:2025/4/16 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 JqueryAjax异步加载在ASP.NET 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

前臺代碼

<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> <script type="text/javascript">function ShowCurrentTime() {$.ajax({url: "webService.aspx/GetCurrentTime",//請求的頁面/頁面處理數(shù)據(jù)的方法type: "POST", //傳輸方式contentType: "application/json;charset=utf-8", //編碼dataType: "json", //格式data: '{name: "' + $("input[name='name']").val() + '" ,age:"' + $("input[name='age']").val() + '"}',//json字符串success: function (data) { //成功以后的回調(diào)函數(shù)alert(data.d);},failure: function (data) {alert(data.d);}})} </script> <body><form id="form1" runat="server"><div><input type="text" name="name" /><input type="text" name="age" /><input type="button" value="獲取當(dāng)前時間" onclick="ShowCurrentTime()" /></div></form>

webService.aspx后臺代碼:

[System.Web.Services.WebMethod] //將 WebMethod 屬性附加到 Public 方法表示希望將該方法公開為 XML Web services 的一部分public static string GetCurrentTime(string name,string age){return "Hello"+name+age+DateTime.Now.ToString();}

?

轉(zhuǎn)載于:https://www.cnblogs.com/tangt/p/4371706.html

總結(jié)

以上是生活随笔為你收集整理的JqueryAjax异步加载在ASP.NET的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。