i'm building a web app using Laravel, and i have to implement tag selection, like this one used by stackoverflow, loading options via ajax and if is not exist create it, i did choose Select2 jquery plugin, the problem i have with it, is cant get it to append parameters to the ajax url,
Route :
/tags/{tag}
how can i append the term of select to my url ?
i'm building a web app using Laravel, and i have to implement tag selection, like this one used by stackoverflow, loading options via ajax and if is not exist create it, i did choose Select2 jquery plugin, the problem i have with it, is cant get it to append parameters to the ajax url,
Route :
/tags/{tag}
how can i append the term of select to my url ?
Share Improve this question asked Nov 3, 2014 at 13:49 Iliyass HamzaIliyass Hamza 1,4053 gold badges17 silver badges30 bronze badges1 Answer
Reset to default 7In Select2 3.x, you can pass a function as the ajax.url
option. It will be passed the current search term as the first parameter, which sounds like what you are looking for.
$element.select2({
...
ajax: {
url: function (term) {
return '/tags/' + term;
},
...
}
});
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745194299a4616015.html
评论列表(0条)