jsonデータからXMLHttpRequestを持つすべてのジョブを表示したいのですが、データを表示できません。この私の機能:jsonとAJAXからデータを返します
function getJobs() {
let httpRequest = new XMLHttpRequest();
httpRequest.open('GET', 'http://codepen.io/jobs.json', true);
httpRequest.onreadystatechange =() => {
if (httpRequest.readyState == 4) {
let data = JSON.parse(httpRequest.responseText);
Object.keys(data).forEach((key) => {
console.log(key[0].company_name); // undefine
});
}
};
httpRequest.send();
}
getJobs();
私のforEachについて私を助けてくれますか? jsonは配列のオブジェクトで、いくつかのオブジェクトがあります^^
ありがとうございました!
を試してみてください。ですから、人間は個人的な解決策に遭遇します。 – reporter
私は 'Object.keys(data).map(key)=> { console.log(data [key] [0] ['タイトル']); });でテストしましたが、私は各ジョブを表示することができません –