我正在尝试解析这个 JSON 字符串:
{ "RESULTS": [ { "name": "Thessaloniki GR", "type": "Sailing", "l": "/sailing-weather/beach:Porto%20Carras%20Marina 45904" }, { "name": "Thessaloniki, Greece", "type": "city", "c": "GR", "zmw": "00000.1.16622", "tz": "Europe/Athens", "tzs": "EET", "l": "/q/zmw:00000.1.16622" } ] }
从这里检索
这是我的片段:
$(document).ready(function () {
$("#w11").autocomplete({
source: function (a, b) {
$.ajax({
url: "http://autocomplete.wunderground.com/aq",
dataType: "jsonp",
data: {
format: "jsonp",
query: a.term
},
success: function (a) {
for (i in data.RESULTS) {
console.log(data.RESULTS);
}
}
})
}
});
});
Uncaught SyntaxError: Unexpected token :
这在第一行给了我一个错误{ "RESULTS": [
如何解析 JSON 结果?