有人知道如何通过twittertype head运行solr,django haystack吗?
我已经在谷歌上搜索了两天了,我不知道如何将haystack django的搜索结果插入twitter的typeahead.js。我所看到的只是一些例子,它们使用存储在数组中的假数据,然后从这些数据中提取数据 这就是我试过的有人知道如何通过twittertype head运行solr,django haystack吗?,solr,django-haystack,twitter-typeahead,Solr,Django Haystack,Twitter Typeahead,我已经在谷歌上搜索了两天了,我不知道如何将haystack django的搜索结果插入twitter的typeahead.js。我所看到的只是一些例子,它们使用存储在数组中的假数据,然后从这些数据中提取数据 这就是我试过的 $(function() { $("#input-field").typeahead({ source:function(query,process) { $.ajax({ type: "GET",
$(function() {
$("#input-field").typeahead({
source:function(query,process) {
$.ajax({
type: "GET",
url: "/posts/search_f/",
data: {
'search_text': $('#search').val(),
'csrfmiddlewaretoken': $("input[name=csrfmiddlewaretoken]").val()
},
success: searchSuccess,
dataType: 'html'
});
}
})
});
function searchSuccess(data, textStatus, jqXHR)
{
$('#search-results').html(data);
}
我试着用这个来修改它
$(function(){
$('#search').keyup(function() {
$.ajax({
type: "GET",
url: "/posts/search_f/",
data: {
'search_text': $('#search').val(),
'csrfmiddlewaretoken': $("input[name=csrfmiddlewaretoken]").val()
},
success: searchSuccess,
dataType: 'html'
});
});
});
function searchSuccess(data, textStatus, jqXHR)
{
$('#search-results').html(data);
}
但它不起作用。如果有人知道解释这一点的教程或可以提供指导,我将不胜感激。在
/posts/search\f
上,服务返回的JSON格式是什么?给出实际数据的示例。使用浏览器开发工具捕获对服务的GET调用。参数是否正确?当你通过邮递员或类似的应用程序呼叫你的服务时会发生什么?