js调用ashx文件 2种类型

js中使用get 的时候, ashx文件中,获取字符串

 

 function check(id, sfsy) {
            $.get('/admin/ashx/check.ashx', { r: Math.random(), id: id, sfsy: escape(sfsy) }, function (data) {
                switch (data) {
                    case "1":
                        alert("已停止!");
                        break;
                    case "0":
                        alert("已使用!");
                        break;
                }
               

            });
        }
$.get  
 string id = context.Request.QueryString["id"].ToString();
 string sfsy = HttpUtility.UrlDecode(context.Request.QueryString["sfsy"]).ToLower();

  

当使用post的时候,ashx文件中需使用From来获取

 function isHasMsg() {
        
            $.post('/admin/ashx/isHasMsg.ashx', { gw: escape($("#hid_gw").val()), r: Math.random() },
               function (data) {
                   if (data == "1") {
                    
                   }                  
               })
        } 
$.post 
 gw = HttpUtility.UrlDecode(context.Request.Form["gw"].ToString());

  

 

posted @ 2014-10-20 09:11  albertwmm  阅读(1292)  评论(0编辑  收藏  举报