从JSONP javascript获取数据

时间:2014-09-02 17:29:39

标签: javascript jsonp

我得到了JSONP服务器响应:

({"Info":"([["xxx",false,"",2,false,null],["yyy","zzzi","123456789","example@com","http://www.e-yyy.pl","example@com","img.jpg",null],["os","aaa","bbb","ccc",null,null,null],["xx_2012","www",2012,2012,2,[["yy_2012",null],["zz_2012",[["dk2","ccc1",1,123.5,null]]]]]])"})

如何从中获取示例@ com?

1 个答案:

答案 0 :(得分:0)

尽管存在安全问题,您仍可以使用eval()。 例如:

//sample
var response_data = '({"Info": 1})';
alert(eval(response_data).Info);

但我认为最好是剥离()并使用JSON.parse,如评论部分所述。

相关问题