Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Vue.config.delimiters = ['<%', '%>']
- new Vue({
- el: '#app',
- data: {
- doctor: {speciality: '', description: '', picked: ''},
- doctors: []
- },
- ready: function () {
- this.getAllDoctors();
- },
- methods: {
- getAllDoctors: function () {
- let that = this;
- $.ajax({
- url: '/getAllDoctors/',
- success: function (response) {
- // that.$set('doctors', response);
- that.doctors = response
- },
- error: function (err) {
- throw err
- }
- });
- },
- addDoctor: function () {
- let that = this;
- // console.log(that.doctor)
- $.post("/newDoctor", {
- name: that.doctor.name,
- description: that.doctor.description,
- schedule_mode: that.doctor.picked
- },
- function (returnedData) {
- console.log(returnedData)
- that.doctors.push(returnedData);
- }).fail(function () {
- console.log(error)
- })
- }
- }
- });
- Vue.use(VueRouter);
- var App = Vue.extend({});
- var router = new VueRouter();
- var Schedule = {
- template: '<h1>hahhaha</h1>'
- }
- router.map({
- '/schedule': {
- component: Schedule
- }
- })
- router.start(App, '#app');
Advertisement
Add Comment
Please, Sign In to add comment