function ReturnOperation(InventoryID) {
//入庫 接口
if (confirm('你確認?')) {
$.ajax({
type: "post",
url: "xxx.aspx/InStorage",
data: "{InventoryID:'"+InventoryID+"'}",//注意,json 對象外面 加 雙引號
contentType: "application/json",
dataType: "json",
success: function (r) {
if (r.d =="1") {
alert("入庫成功");
} else {
alert("入庫失敗");
}
},
error: function (e) {
alert("錯誤是:" + e.responseText);
}
})
} else {
}
}
這是前端code
[WebMethod] //注意添加引用,方法為靜態 public static string InStorage(string InventoryID) { return InventoryID; }
這是xxx.aspx 頁面內的方法
