使用AJAX返回WebService里的集合具體實(shí)現(xiàn)_AJAX教程
推薦:AJAX獲取服務(wù)器當(dāng)前時間及時間格式輸出處理本文整理了關(guān)于AJAX獲取服務(wù)器當(dāng)前時間的知識,不會的朋友可以參考下哈,希望對你有所幫助
復(fù)制代碼 代碼如下:www.hl5o.cn
-------------------WebService1 -----------------------------
// 若要允許使用 ASP.NET AJAX 從腳本中調(diào)用此 Web 服務(wù),請取消對下行的注釋。
[System.Web.Script.Services.ScriptService]
public class WebService1 : System.Web.Services.WebService
{
[WebMethod]
public List<string> GetList()
{
List<string> list = new List<string>();
list.Add("王一");
list.Add("22");
list.Add("河北");
return list;
}
}
--------------------HTMLPage1.htm-----------------------
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="js/Jquery1.7.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#Button1').click(function () {
$.ajax({
type: "post",
contentType: "application/json",
url: "WebService1.asmx/GetList",
data: "{}",
success: function (result) {
var str = '';
for (var i = 0; i < result.d.length; i++) {
str += result.d[i];
}
$('#mydiv').text(str);
}
})
})
})
</script>
</head>
<body>
<div id="mydiv"></div>
<input id="Button1" type="button" value="button" />
</body>
</html>
分享:ajax傳遞多個參數(shù)具體實(shí)現(xiàn)在使用ajax過程中,傳遞參數(shù)是在所難免的尤其在特殊情況下傳遞多個參數(shù),下面與大家分享下具體的是實(shí)現(xiàn)方法,感興趣的朋友可以參考下哈
相關(guān)AJAX教程:
- Ajax中瀏覽器的緩存問題解決方法
- AJAX和WebService實(shí)現(xiàn)省市縣三級聯(lián)動具體代碼
- ajax 登錄功能簡單實(shí)現(xiàn)(未連接數(shù)據(jù)庫)
- AJAX和WebService實(shí)現(xiàn)郵箱驗證(無刷新驗證郵件地址是否合法)
- AJAX和三層架構(gòu)實(shí)現(xiàn)分頁功能具體思路及代碼
- AJAX獲取服務(wù)器當(dāng)前時間及時間格式輸出處理
- ajax傳遞多個參數(shù)具體實(shí)現(xiàn)
- ajax傳遞一個參數(shù)具體實(shí)現(xiàn)
- 滑輪滾動到頁面底部ajax加載數(shù)據(jù)配合jsonp實(shí)現(xiàn)探討
- jQery ajax——load()方法示例介紹
- jQuery+Ajax實(shí)現(xiàn)表格數(shù)據(jù)不同列標(biāo)題排序(為表格注入活力)
- 利用Ajax實(shí)現(xiàn)在腳本里傳值實(shí)例介紹
- 相關(guān)鏈接:
- 教程說明:
AJAX教程-使用AJAX返回WebService里的集合具體實(shí)現(xiàn)
。