我读变JSON问题海槽REST API广东话读JSON变量槽REST API
问题:
的json
.....
“Featured_media”:11661,
“Comment_status”, “打开”
“Ping_status”, “打开”
“Geolocation_city”:[ “Oeiras的”],
“_links”:{
“Self”:[{
“Href”:“http:\/\/website.com \/wp-json \/wp \/v2 \/listing \/11660”
.....
我可以读取所有的变量,此代码
$.getJSON('http://imaginocharme.com/wp-json/wp/v2/listings/11660', function (jd) {
$('#stage').html('<p> Nome: ' + jd.featured_media + '</p>');
console.log(jd.featured_media);
$('#stage').append('<p>Descrição : ' + jd.comment_status + '</p>');
console.log(jd.comment_status);
$('#stage').append('<p>Nome : ' + jd.ping_status + '</p>');
console.log(jd.ping_status);
$('#stage').append('<p>Cidade : ' + jd.geolocation_city + '</p>');
console.log(jd.geolocation_city);
$('#stage').append('<p>Links : ' + jd._links.self[0].href + '</p>');
console.log(jd._links.self[0].href);
});
我的控制台日志少geolocation_city
11661
index.html (29,29)
open
index.html (31,29)
open
index.html (33,29)
undefined
index.html (35,29)
http://imaginocharme.com/wp-json/wp/v2/listings/11660
index.html (37,29)
我试过几种方法来读取变量geolocation_city和总给人不确定
谁能帮助?
有什么想法?
你确定,大写/小写变量名不是问题吗? –