jquery ajax 实现从service读取数据,done

 $.ajax({
type: "POST",
contentType: "application/json",
url: "../service/Orgsvc.asmx/GetNamePathSub", //note:the asmx need relative path here注意路径和平时的引用页面一样
data: "{oid:'" + orgid + "'}", // parameter:oid need same as svc method 参数最好是和svc的一样,免得搞混
dataType: 'json',
success: function(result) {

orgPath = result.d;
chbarray[orgid] = ({ name: orgName, value: orgid, path: orgPath });
////push all item 执行操作要放在这里面,不然就不会实时反应了

for (var key in chbarray) {
var ob = chbarray[key];
if (!isContainOrg(ob.value) && !isOrgSelected(ob.value))
$("#lstwaiter").append('<option value="' + ob.value + '">' + ob.path + '</option>');
}

}
});



});


编辑器加载中...

posted on 2011-09-29 23:42  SUNJUNLIN  阅读(1588)  评论(0编辑  收藏  举报

导航