gpt4 book ai didi

ajax - Twitter Bootstrap Typeahead 不处理响应

转载 作者:行者123 更新时间:2023-12-01 04:54:58 24 4
gpt4 key购买 nike

我有 Spring MVC Controller :

@Controller
@RequestMapping(value = "/bla")
public class TestController {
@RequestMapping(value = "json", method = RequestMethod.POST)
public @ResponseBody String getJson(@ModelAttribute SearchQueryJson searchQueryJson) {
System.out.println("hih");
System.out.println(searchQueryJson.getQuery());
return new String("{'asd','asdd'}");
}
}

和js:
<script>
$("#searchbox").typeahead({
source: function (typeahead, query) {
return $.post("bla/json", { query: query }, function (data) {
return typeahead.process(data);
});
}
});
</script>

在 google chrome 调试器中,我看到响应 {'asd','asdd'},但没有任何 react (搜索框的下拉菜单不出现)!我正在使用 twitter bootstrap typeahead (method 'toLowerCase' of undefined)https://gist.github.com/2712048

最佳答案

更改 return typeahead.process(data);
return typeahead(data);

关于ajax - Twitter Bootstrap Typeahead 不处理响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11502880/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com