日期:2014-05-16 浏览次数:20743 次
[OperationContract]
public List<string> TestList()
{
return new List<string>() { "1111", "222", "333" };
}
$.ajax({
type: "POST",
url: "WDCProxy.svc/TestList",
dataType: "json",
success: function (response) {
alert(response.d);
},
error: function (response) {
alert(response.d);
}
});
$.ajax({
url: "test.asmx/GetName",///////注意修改webservice名称
type: "POST",
dataType: "json",
contentType: "application/json; charset=utf-8",//////
data: "{txt:123}",
success: function (json) { alert("Success:"+json.d); },
error: function (x, e) { alert("Error:"+x.responseText); }
});