普通数组:
var ary = ['a','b',1,2,3,4]下标就能访问到,历遍可以使用下标获取里面的值
字典数字:
// 相当于把这个数组附加某些属性,无法用下标访问,对象的访问方式才能获取定义的值。// for无法使用下标访问,for in 可以
var ary=[]
ary['a']=1
ary['b']=2
ary['c']=3
用JSON返回代码,动态加载到html
参考:
<script language="javascript" type="text/javascript">function getSearchDataListURL(pageIndex, pageSize) {
var url = '<%=this.ResolveClientUrl("~/Common/SearchDataList.ashx") %>?action=searchlistbyfilter&objName=BedFloor'
url += "&pagesize=" + pageSize
url += "&pageindex=" + pageIndex
url += "&keywords=" + encodeURIComponent(document.getElementById("keywords").value)
url += "&status=" + (document.getElementById("<%=this.ddl_Status.ClientID %>").value)
url += "&buildingid=" + (document.getElementById("<%=this.ddl_Building.ClientID %>").value)
return url
}
function LoadDataSrc(pageIndex, pageSize) {
$.ajax({
url: getSearchDataListURL(pageIndex, pageSize),
type: "get",
dataType: "json",
success: function (data) {
bindDataSource(data.DataList, pageIndex, pageSize, data.TotalRecordCount)
},
error: function (er) {
alert("错误信息:" + er)
}
})
}
</script>