Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 使用Wordpress的Thermal API解析JSON_Jquery_Ajax_Json_Wordpress - Fatal编程技术网

Jquery 使用Wordpress的Thermal API解析JSON

Jquery 使用Wordpress的Thermal API解析JSON,jquery,ajax,json,wordpress,Jquery,Ajax,Json,Wordpress,我正在使用将我的wordpress博客的帖子发布到我目前正在本地开发的另一个网站上。我使用jqueryajax函数发出请求并检索内容节点,但是数据没有通过。谁能指出我做错了什么 $(文档).ready(函数(){ $.ajax({ 网址:'http://tubecrush.net/wp_api/v1/posts?callback=show', 数据类型:“jsonp”, 键入:“获取”, 成功:功能(数据){ $('#result').html(data.content); } }); });

我正在使用将我的wordpress博客的帖子发布到我目前正在本地开发的另一个网站上。我使用jqueryajax函数发出请求并检索内容节点,但是数据没有通过。谁能指出我做错了什么

$(文档).ready(函数(){
$.ajax({
网址:'http://tubecrush.net/wp_api/v1/posts?callback=show',
数据类型:“jsonp”,
键入:“获取”,
成功:功能(数据){
$('#result').html(data.content);
}
});
});

结果:
尝试利用

JSONP

如果URL包含字符串
“callback=?”
(或类似字符串,如 服务器端API),请求被视为JSONP

注意,返回的
数据
对象似乎具有属性名
posts
以对象数组作为值<代码>内容
属性值”<代码>内容\u显示属性值似乎包含
html

另见

$.getJSON(“http://tubecrush.net/wp_api/v1/posts?callback=?")
.then(函数(数据、文本状态、jqxhr){
$.each(data.posts,函数(key,html){
$(“#结果”).append(html.content_display)
});
//返回承诺返回值`数据`
//返回数据
},函数(jqxhr,textStatus,errorshown){
console.log(textStatus,errorshown)
})

结果: