Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var categorySelect = $('#category_select');
- var productSelect = $('#product_select');
- categorySelect.select2();
- productSelect.select2();
- categorySelect.on('change',function () {
- var categoryId = $(this).val();
- var url = "{{url("/ajax/category/:category/products")}}";
- url = url.replace(":category",categoryId);
- $.get(url,function (res) {
- var res = [
- {id: 900, text: 'AABB'},
- {id: 800, text: 'WWBB'},
- ]; // dummy response
- productSelect.select2('data',res);
- })
- })
Add Comment
Please, Sign In to add comment