Guest User

Untitled

a guest
Nov 23rd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. <script>
  2. searchContent = new Vue({
  3. el: "#searchContent",
  4. data: {
  5. vector: {}
  6. }
  7. });
  8. categories = new Vue({
  9. el: '#categories',
  10. data: {
  11. category: 0,
  12. subcategory: 0,
  13. content: false
  14. },
  15. watch: {
  16. subcategory: function(e) {
  17. this.prefetch();
  18. },
  19. category: function(e) {
  20. this.prefetch();
  21. },
  22.  
  23. },
  24.  
  25.  
  26. methods: {
  27. prefetch: function() {
  28. var filter = {};
  29. filter['category'] = this.category;
  30. filter['subcategory'] = this.subcategory;
  31. if (this.content !== false)
  32. this.content.abort()
  33. this.content = $.ajax({
  34. 'url': 'filter/',
  35. data: filter,
  36. dataType: "JSON",
  37. type: "POST",
  38. success: function(e) {
  39. window.searchContent.vector = e.data;
  40. console.log(e);
  41. }
  42. })
  43. }
  44. }
  45.  
  46. })
  47. </script>
  48.  
  49. {"status": true, "data": []}
  50.  
  51. <div id="searchContent" >
  52. <div v-for="row in vector" >{{row.bussinessName}}
  53. </div>
  54. <div>
Add Comment
Please, Sign In to add comment