这个jquery数组有什么问题

时间:2012-08-28 13:03:29

标签: jquery arrays json

可能是一件非常简单但我无法理解的事情。我有以下命令。返回一个json数组。

var zz = fm.request({
                    data : {cmd : 'url', target : hash},
            preventFail : true,
            options: {async: true},


        })


        alert (zz.cmd); // or alert (zz.url);//  tried every combination I can think of. Must be something wrong with the way I am calling it.

这输出以下json。

{"url":"https:\/\/test.com\/s\/tx74i3t9cet49xi\/vlc-record-2009-10-03-06h26m55s-http___79.125.42.98_film4_ls_auth%3D2e2fd32b2d221ce406085c03ec01722f-.ts","debug":{"connector":"php","phpver":"5.3.15","time":1.9966609477997,"memory":"4852Kb \/ 3932Kb \/ 128M","upload":"","volumes":[{"id":"l1_","name":"localfilesystem","mimeDetect":"finfo","imgLib":"gd"},{"id":"d2_","name":"dropbox","mimeDetect":"finfo","imgLib":"gd"}],"mountErrors":[]}}

我只需要提醒网址。我没有被定义,或者什么也没有。

发布请求。

cmd         url
target    d2_LzY4NV9DbGllbnRCdWdzXzIueGxzeA
Source   cmd=url&target=d2_LzY4NV9DbGllbnRCdWdzXzIueGxzeA

2 个答案:

答案 0 :(得分:0)

应为alert(zz.data.cmd)

答案 1 :(得分:0)

选项哈希后的额外逗号。 您可以在www.jsonlint.org上验证您的JSON数据/哈希 加上@Ray发布的内容

{
"data": {
    "cmd": "url",
    "target": "hash"
},
"preventFail": true,
"options": {
    "async": true
}
}
相关问题