新建建Web服務頁面(*.asmx)
函式如下:
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
js呼叫如下:
$.ajax({
type: "POST",
url: "/Webservice/test.asmx/HelloWorld",
data: "{"Product_ID":"" + ProductID + ""}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
try {
//do something
} catch (e) {
},
error: function () {
return false;
});
新建建Web服務頁面(*.asmx)
函式如下:
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
js呼叫如下:
$.ajax({
type: "POST",
url: "/Webservice/test.asmx/HelloWorld",
data: "{"Product_ID":"" + ProductID + ""}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
try {
//do something
} catch (e) {
}
},
error: function () {
return false;
}
});