我为我的 Asp.net 项目创建了一个 Web 服务。目前,我通过在ScriptManager
. 但我不想添加一个ScriptManager
以便我可以在任何 HTML 页面中使用它。
问问题
1057 次
1 回答
1
Ok. so you want to make ajax call to some web-service method and pass parameters to it. And you are going to pass the parameters as JSON format
function CallWebServiceMethod() {
var requestedData = "{ 'LifeCycleN': '" + var_LifeCycleN +//var_LifeCycleN some var represent your data that you want to send
"', 'LiOrder': '" + var_LiOrder +//var_LiOrder again some var represent your data that you want to send
"'}";
$.ajax({
type: "POST",
url: "Services/YouWebServiceName.asmx/WebServiceMethodName",
data: requestedData,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {// I 'll assume that your web-service 'll return bool value indicate if the operation done successfully or not.
//do here what you want to do is the request was successful.
}
});
}
于 2013-03-12T11:44:31.910 回答