我在我的web應用程序中使用jQuery自動完成。我跟着這個http://jqueryui.com/demos/autocomplete/#remote-jsonp當發送請求,建議將它發送到不同的URL不是一個我在$.ajax()
網址jquery - 自動完成url
這裏是jQuery代碼給出:
$("#add-keywords").autocomplete({
source: function(request, response) {
var q = $("#add-keywords").val();
$.ajax({
url: "keywords_suggestions/",
dataType: "json",
data: {
query: q
}
});
},
minLength: 2,
select: function(event, ui) {
log(ui.item ?
"Selected: " + ui.item.label :
"Nothing selected, input was " + this.value);
}
});
我使用Django服務器方腳本。它實際上一定要請求到這個URL http://127.0.0.1:8000/keywords_suggestions
但它請求這個URL http://127.0.0.1:8000/information/?query=web
爲什麼是這樣?
謝謝!
您是否找到了解決方案?我遇到了同樣的問題。 –
請分享網址.. –
不是主要問題,但你指的是log(),可能不是console.log() – user3041539