目前我有一个按钮,使用jQuery/AJAX从SharePoint列表中搜索所有客户,并且我的Web服务返回一个XML字符串。然后我使用XML中的数据填充下拉列表。如何将参数传递给asp.net web服务并返回xml?
我知道想传递一个搜索函数的参数(客户名称),我可以从SharePoint列表返回我想要的东西,但我的AJAX调用返回错误(parseerror)。
要获得所有客户的(工作):
$.ajax({
type: "GET",
url: "SynchroniseCustomers.asmx/GetAllCustomers",
dataType: "text/xml",
error: function (xhr, status) {
hideLoading();
},
beforeSend: function() {
showLoading("customers");
},
success: function (xml) {
hideLoading();
populatecustomerDropdownList($(xml).text());
}
});
我不知道如何去这个,但我试过
VAR的客户=客户名称;
$.ajax({
type: "GET",
data: { CustomerName: JSON.stringify(customer) },
url: "SynchroniseCustomers.asmx/GetCustomerByName",
dataType: "json",
error: function (xhr, status) {
hideLoading();
alert(xhr + " " + status);
},
beforeSend: function() {
showLoading("Customers");
},
success: function (xml) {
hideLoading();
populateCustomerDropdownList($(xml).text());
}
});
有人可以请指出我在正确的方向如何执行此?
在此先感谢。
谢谢Gary,我将xml传递给一个名为populatecustomerDropdownList的函数 – Nick 2011-04-20 09:32:42