我有以下 JSON 数据馈送:
jQuery191029421305245357143_1380819227858(
{
"responseHeader": {
"status": 0,
"QTime": 127
},
"command": "build",
"spellcheck": {
"suggestions": [
"restaurant",
{
"numFound": 1,
"startOffset": 0,
"endOffset": 10,
"suggestion": [
"restaurants"
]
},
"berl",
{
"numFound": 4,
"startOffset": 11,
"endOffset": 15,
"suggestion": [
"berlin",
"berlin brandenburg",
"berlin hamburg",
"berliner"
]
},
"collation",
"restaurant berlin",
"collation",
"restaurant (berlin brandenburg)",
"collation",
"restaurants berlin",
"collation",
"restaurant (berlin hamburg)"
]
}
}
)
我尝试在 JQuery 中访问以下数据:
"restaurant berlin"
"restaurant (berlin brandenburg)"
"restaurants berlin"
"restaurant (berlin hamburg)"
到目前为止,我有以下 JQUERY 代码:
success: function( data ) {
response( $.map(data.spellcheck.suggestions, function(item) {
return item;
}));
这是有效的,但返回我所有的值,而不仅仅是上面概述的 4 个数据集。
谢谢您的帮助!