我得到JSON响应我将如何解析这个每个返回的数据?解析JSON数据的jQuery每个这样</p> <pre><code>{"item_id":"1","item_title":"Item 1"}{"item_id":"2","item_title":"Item 2"} </code></pre> <p>
试图
$.ajax({
url: 'linktojson',
type: "post",
dataType: "json",
success: function (response) {
//console.log('isok');
if (response.item_id) {
$('#posts').html(response.item_id);
}
}
});
,但只适用,如果我有在响应1项。
谢谢!
试图响应[0] .item_id ? –
这不是有效的JSON – Musa
反应不能是一系列的对象,需要只有一个对象。贯穿jsonlint.com你的回应检查验证 – charlietfl