首页 新闻 会员 周边

关于JQuery 的getJSON返回值问题

0
悬赏园豆:10 [已关闭问题]

为什么

 function(json){
    $.each(json,function(i){
            alert(i);      
    });
   }

获取不到返回值呢.我用的是  jquery-1.3.min.js

前台JS代码:

 $("input[type=button]:eq(2)").click(function(){
  alert("getJSON");
  $.getJSON(
   "Handler.ashx",
   {file:"file"},
   function(json){
    $.each(json,function(i){
            alert(i);      
    });
   });
 });

 

后台代码:

        context.Response.ContentType = "text/plain";

        context.Response.Write(GetString(context.Request.QueryString["file"]));

   public string GetString(string file)
    {
        string temp = "";
        if (file == "file")
        {
            temp = "[{name=\"jdk\",age=30},{name=\"Lucy\",age=55}]";
        }
        else if (file == "filename")
        {
            temp = "[{name=\"aaa\",age=300},{name=\"bbb\",age=555}]";
        }
        return temp;
    }

help_hostwork的主页 help_hostwork | 初学一级 | 园豆:6
提问于:2009-04-07 14:57
< >
分享
其他回答(1)
0

var o = eval('('+json+')');

povy | 园豆:214 (菜鸟二级) | 2009-04-07 15:36
0

";"  多了吧.

2020bb | 园豆:330 (菜鸟二级) | 2009-04-07 16:44
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册