欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jquery異步循環(huán)獲取功能實(shí)現(xiàn)代碼

 更新時(shí)間:2010年09月19日 21:23:26   作者:  
頁(yè)面html的repeater控件中有一個(gè)span,需要根據(jù)指定ID異步獲取相關(guān)信息。
html代碼:
復(fù)制代碼 代碼如下:

<table id="repTable"……>
……
<span id="<%# Eval("Id") %>" class="address"></span>
</table>

jquery代碼:

復(fù)制代碼 代碼如下:

$(document).ready(function(){
$("#repTable span.address").each(function(){
var spanTemp = $(this);
$.ajax({
type: "get",
url: "SceneryAjaxCall.aspx",
data: "sid="+$(this).attr("id"),
cache: true,
dataType: "html",
success: function(msg){
spanTemp.append(msg);
}
});
});
});


其中在寫jquery代碼時(shí),我遇到了下面幾個(gè)問題:

(1)開始沒寫第三行,而是在第十一行直接調(diào)用的$(this),報(bào)錯(cuò)“不能給回調(diào)函數(shù)賦值”。原因是回調(diào)后對(duì)象已經(jīng)發(fā)生改變,所以需要事先保存;

(2)沒寫dataType,發(fā)現(xiàn)不能返回msg,不知道為什么;

相關(guān)文章

最新評(píng)論