我想知道我怎麼能正確地從下面的JSON返回數據獲取JSON:假裝我有一個網址http://test.com/tesdata使我有以下數據:如何從一個陣列
[{"Identifier":1, "Name":"Test"},
{"Identifier":2, "Name":"Test"},
{"Identifier":3, "Name":"Test"}]
所以我做了按照一個div來獲得這樣的數據:
$.ajax({
type: 'GET',
url: 'http://notgiven',
data: { get_param: 'value' },
dataType: 'json',
success: function (data) {
alert("s");
$.each(data, function(index, element) {
$('.result').append("a");
});
},
error: function(jqXHR, textStatus, errorThrown){
alert("jqXHR: " + JSON.stringify(jqXHR));
alert("textStatus: " + JSON.stringify(textStatus));
alert("errorThrown: " + JSON.stringify(errorThrown));
}
});
,我得到以下錯誤無法解析JSON字符串
你有多遠?錯誤發生在哪裏? – 2012-08-13 12:04:53
測試:'element.Identifier +''+ element.Name' – 2012-08-13 12:05:53
數組中有一個額外的'}'。 – undefined 2012-08-13 12:06:45