1
我想在動態列表內使用jQuery手機創建動態列表 我試圖使用item.On("click", callGroups);
但我無法將參數傳遞給該函數。 我使用jQuery Mobile的1.3和jQuery 1.8阿賈克斯項目動態列表點擊創建新的子列表
,這是我的Ajax代碼
<script type="text/javascript" type="text/javascript">
$(document).ready(function() {
Greating();
});
// $(document).on('pageinit', function() {
function callGroups(ID)
{
$("#"+ID).append("<ul><li> first</li><li>second item</li> </a></li> ");
}
function Greating() {
$.ajax({
type: "POST",
url: "CarService.asmx/GetAllsections",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
var sections = response.d;
$('#page_body').append("<div data-role='page' id= 'ssaadd'><div>");
$.mobile.initializePage();
$.each(sections, function (index, section) {
// asd = "listsec" + section.secId;
$("#theList").append("<li> <a id = '"+section.secId+"' ><img src='pic/" + section.SecImg + "'> <br /> " + section.SecName + ' ' + section.SecArbName + " <br />" + section.SecArbDiscr + "").on("click", callGroups();
});
console.log(response);
},
error: function (response) {
$("#theList").append("<li>error<li>");
console.log(response);
}
});
}
</script>
如何建立內部動態列表,動態列表?
它正在工作,但它不斷在同一頁面中添加新列表,我希望它被隱藏,當我點擊該項目時,新列表生成並在新頁面中打開 – 2013-03-17 17:47:13