我从自定义 wordpress 帖子类型中回显了以下内容get-client-logos.php
[{
"name": "One",
"url": "http://localhost/wp-content/uploads/2012/10/random04-128x84.jpg"},
{
"name": "Two",
"url": "http://localhost/wp-content/uploads/2012/10/chuck_norris_random_fact_generator_6_3957_2224_image_2578-128x84.jpg"
}]
我正在尝试从每个 json 对象中提取 url,如下所示:
$.getJSON('get-client-logos.php/', function (data) {
var items = [];
$.each(data, function(key, val) {
items.push('<img src ="' + val + '"/>');
});
console.log(items);
});
在 console.logging 中,我得到以下信息:
["img src ="[object Object]"/", "img src ="[object Object]"/"]
如何返回值而不是 typeOf?