我在我的网站中使用这个插件:http: //sandglaz.github.io/bootstrap-tagautocomplete/
它的默认选项是:
$(document).ready(function(){
$('div#autotag').tagautocomplete({
source: ['@ann', '@andrea', '@aaron', '@daryl', '@emma', '@faris', '@june', '@jane', '@jessica', '@john', '@myra', '@maria', '@mariam', '@mention', '@mona', '@omar', '@peter', '@quinn', '@rana', '@sam', '@simon', '@tom', '@upton', '@veronica', '@wayne', '@yasmin', '@zaid', '#work', '#product', '#marketing', '#customer'],
character: '@#'
});
$('div#autotag').first().focus();
});
<div id="example" contenteditable="true"></div>
但我想要带有“Ajax”选项的源代码,如下所示:-
jQuery(document).ready(function() {
jQuery('div#poststatus').tagautocomplete({
source: 'http://laravel.local/list',
character: '@#'
});
});
<div id="example" contenteditable="true"></div>
在列表中,资源是:-
['@ann', '@andrea', '@aaron', '@daryl', '@emma', '@faris', '@june', '@jane', '@jessica', '@john', '@myra', '@maria', '@mariam', '@mention', '@mona', '@omar', '@peter', '@quinn', '@rana', '@sam', '@simon', '@tom', '@upton', '@veronica', '@wayne', '@yasmin', '@zaid', '#work', '#product', '#marketing', '#customer']
但这不起作用。是否有可能使其ajaxified?
我有 textarea,用户将在其中输入更多文本,并且也可以有多个标签……比如 twitter 推文框。
谢谢