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,
/tags/{tag}
how can i append the term of select to my url ?
In 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;
},
...
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With