Guest User

Untitled

a guest
Sep 25th, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. Vue.config.delimiters = ['<%', '%>']
  2.  
  3. new Vue({
  4. el: '#app',
  5. data: {
  6. doctor: {speciality: '', description: '', picked: ''},
  7. doctors: []
  8. },
  9. ready: function () {
  10. this.getAllDoctors();
  11. },
  12. methods: {
  13. getAllDoctors: function () {
  14. let that = this;
  15. $.ajax({
  16. url: '/getAllDoctors/',
  17. success: function (response) {
  18. // that.$set('doctors', response);
  19. that.doctors = response
  20. },
  21. error: function (err) {
  22. throw err
  23. }
  24. });
  25.  
  26.  
  27. },
  28. addDoctor: function () {
  29. let that = this;
  30. // console.log(that.doctor)
  31. $.post("/newDoctor", {
  32. name: that.doctor.name,
  33. description: that.doctor.description,
  34. schedule_mode: that.doctor.picked
  35. },
  36. function (returnedData) {
  37. console.log(returnedData)
  38. that.doctors.push(returnedData);
  39. }).fail(function () {
  40. console.log(error)
  41. })
  42.  
  43. }
  44. }
  45. });
  46.  
  47.  
  48. Vue.use(VueRouter);
  49. var App = Vue.extend({});
  50.  
  51. var router = new VueRouter();
  52. var Schedule = {
  53. template: '<h1>hahhaha</h1>'
  54. }
  55.  
  56. router.map({
  57. '/schedule': {
  58. component: Schedule
  59. }
  60. })
  61.  
  62. router.start(App, '#app');
Advertisement
Add Comment
Please, Sign In to add comment