首页 新闻 赞助 找找看

jquery 运用

0
悬赏园豆:5 [已解决问题] 解决于 2012-07-12 16:21

在不刷新页面的情况下 将ashx文件返回的值在页面上更新

liyongchao1002的主页 liyongchao1002 | 菜鸟二级 | 园豆:202
提问于:2012-07-12 09:45
< >
分享
最佳答案
1

$.post("xxx.ashx",{参数名:参数值},function(msg){ })

收获园豆:2
1行受影响 | 初学一级 |园豆:113 | 2012-07-12 09:48
其他回答(4)
0
   $.ajax({
            type
:"POST",
            url
:"handler.ashx",
            data
:{ firstName:'stack', lastName:'overflow'},
           
// DO NOT SET CONTENT TYPE to json
           
// contentType: "application/json; charset=utf-8",
           
// DataType needs to stay, otherwise the response object
           
// will be treated as a single string
            dataType
:"json",
            success
:function(response){
                alert
(response.d);
           
}
       
});



usingSystem;
   
usingSystem.Web;
   
usingNewtonsoft.Json;

   
publicclassHandler:IHttpHandler
   
{
       
publicvoidProcessRequest(HttpContext context)
       
{
            context
.Response.ContentType="text/plain";

           
string myName = context.Request.Form["firstName"];

           
// simulate Microsoft XSS protection
           
var wrapper =new{ d = myName };
            context
.Response.Write(JsonConvert.SerializeObject(wrapper));
       
}

       
publicboolIsReusable
       
{
           
get
           
{
               
returnfalse;
           
}
       
}
   
}
收获园豆:1
悟行 | 园豆:12559 (专家六级) | 2012-07-12 09:48
0

ajax,哈哈,jquery支持的。读一下jquery ajax api就成,非常简单。

收获园豆:1
jerry-Tom | 园豆:4077 (老鸟四级) | 2012-07-12 10:11
0

ajax,可以实现的

收获园豆:1
code先生-null | 园豆:307 (菜鸟二级) | 2012-07-12 16:16
0

ajax 的运用搞好了。自己这方面得加强了

liyongchao1002 | 园豆:202 (菜鸟二级) | 2012-07-12 16:19
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册