Php jQuery标记:自动完成不起作用
我使用的是jquery tagit api,我编写的代码如下Php jQuery标记:自动完成不起作用,php,javascript,jquery,tags,Php,Javascript,Jquery,Tags,我使用的是jquery tagit api,我编写的代码如下 $(document).ready(function() { $("#mytags").tagit({ tagSource: function(search, showChoices) { $.ajax({ url: "http://localhost/UI/user/taggin.php", data: {search: search.term}, succ
$(document).ready(function() {
$("#mytags").tagit({
tagSource: function(search, showChoices) {
$.ajax({
url: "http://localhost/UI/user/taggin.php",
data: {search: search.term},
success: function(choices) {
showChoices(choices);
}
});
}
});
});
这是我的html
<tr>
<td>Tags</td>
<td><input id="mytags" class= "ulc" name = "mytags"></ul>
</td>
</tr>
json格式
请告诉我我做错了什么,这样我的自动完成功能就不能在这里工作了
tagSource: function(search, showChoices) {
var that = this;
$.ajax({
url: "/tags/autocomplete.json",
data: {
q: search.term
},
success: function(choices) {
showChoices(that._subtractArray(choices, that.assignedTags()));
}
});
}
看看这个是另一个选项。选择jquery比tagit更好
tagSource: function(search, showChoices) {
var that = this;
$.ajax({
url: "/tags/autocomplete.json",
data: {
q: search.term
},
success: function(choices) {
showChoices(that._subtractArray(choices, that.assignedTags()));
}
});
}