0
私はAjaxコールを練習しており、返されたJSONデータにアクセスする際に問題が発生しています。jqueryでjsonデータを操作する
私はちょうど出力に私のJSONオブジェクトのcontent
とlink
プロパティをしようとしている
[
{
"ID": 1127,
"title": "Paul Rand",
"content": "<p>Good ideas rarely come in bunches. The designer who voluntarily presents his client with a batch of layouts does so not out prolificacy, but out of uncertainty or fear. </p>\n",
"link": "https://quotesondesign.com/paul-rand-7/"
}
]
を出力
$('button').on('click', function() {
$.ajax({
url: 'http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1',
success: function(data) {
console.log(data);
},
error: function() {
console.log('error occured');
},
cache: false
});
});
の下に次のコードを持っています。私は、次のことを試してみた:
[{"ID":2294,"title":"Josh Collinsworth","content":"
You do not need to have a great idea before you can begin working; you need to begin working before you can have a great idea.
\n","link":"https://quotesondesign.com/josh-collinsworth-3/"}]
を出力
$('.message').html(JSON.stringify(data));
私はJSONデータを操作するための標準的な方法は、すべての助けに感謝を探すためにしようとしています!
uはインデックス0を明確にすることができますか? –
はい、質問 – miken32
ああを編集します。私は今すべてをはっきりと見ることができます。助けてくれてありがとう!!! APIを使って作業することは既に素晴らしいです!!!! –