Guest User

Untitled

a guest
Apr 26th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. var categorySelect = $('#category_select');
  2. var productSelect = $('#product_select');
  3. categorySelect.select2();
  4. productSelect.select2();
  5. categorySelect.on('change',function () {
  6. var categoryId = $(this).val();
  7. var url = "{{url("/ajax/category/:category/products")}}";
  8. url = url.replace(":category",categoryId);
  9. $.get(url,function (res) {
  10. var res = [
  11. {id: 900, text: 'AABB'},
  12. {id: 800, text: 'WWBB'},
  13. ]; // dummy response
  14. productSelect.select2('data',res);
  15. })
  16. })
Add Comment
Please, Sign In to add comment