VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > 编程开发 > c#教程 >
  • C#教程之C#教程之WebForm 页面ajax 请求后台页面 方法

本站最新发布   C#从入门到精通
试听地址  
https://www.xin3721.com/eschool/CSharpxin3721/

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 页面内的方法

相关教程