注册 登录
编程论坛 JavaScript论坛

获取json数据

yaopeng0418 发布于 2010-08-10 15:25, 939 次点击
返回数据为:
response.Write escape("{"&"data:"&"<font  color='#009900' style='font-size:12px'>"&rs3("FIRST_NAME")&"</font> <font  color='#009900' style='font-size:12px'>"&rs3("SUBMIT_DATE")&"</font><br><font color='"&rs3("LAST_NAME")&"' style=' font-weight:"&rs3("fweight")&"; font-style:"&rs3("fstyle")&"; text-decoration:"&rs3("fdeco")&";font-family:"&rs3("font")&";font-size:"&rs3("fsize")&"'>&nbsp;"&",comm:"&""&rs3("COMMENTS")&""&"font:"&"</font>"&"}")
接受为:
var text=unescape(xmlhttp.responseText);
var json=eval("(" + text + ")");
if(json["comm"]!="")
{
    var da=$("table");
    var td=da.append("<tr><td>"+ json["data"] + json["comm"] + json["font"] +"</td></tr>");
    sc();

}
可是怎么也获取不了数据,请教高手指点
2 回复
#2
foktime2010-08-10 17:19
看着那json数据太费神了 是不是response.Write escape(json数据)外面应该去掉引号  外面也有双引号json数据应该是被断了
要么你就分开写试试
程序代码:
var myJSONObject = {"bindings": [
         {"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"},
         {"ircEvent": "PRIVMSG", "method": "deleteURI", "regex": "^delete.*"},
         {"ircEvent": "PRIVMSG", "method": "randomURI", "regex": "^random.*"}
     ]
};  
类似这样的,然后response.Write escape(myJSONObject);
#3
qingshuiliu2010-08-11 14:36
楼主给的信息不全面,如果你想大家帮助你,就把信息尽量提供的全面一些。
比如,Response.Write() 这里完整的json数据。


1