jquery - resourceId not being reset after ajax request -
so select function within fullcalendar, i'm using add appointments calendar. on first appointment add calendar, resourceid variable correct, , appointment gets added in correct position. there on out, time add appointment, gets added under resource, variable never changes resourceid slot clicked on in calendar.
select: function(start, end, event, view, resource) { $("#addeventmodal").modal('show'); $("#addappt").submit(function(e) { $("#apptsubmit").attr("disabled", true); e.preventdefault(); e.stopimmediatepropagation(); console.log(resource.id); var formdata = $(this).serialize() + '&start=' + moment(start).format('yyyy-mm-dd hh:mm:ss') + '&end=' + moment(end).format('yyyy-mm-dd hh:mm:ss') + '&resourceid=' + resource.id; $.ajax({ url: '/dentist/db/createappt.php', type: 'post', data: formdata, success: function(){ $('#addeventmodal').modal('hide'); calendar.fullcalendar('refetchevents'); $("#apptsubmit").attr("disabled", false); }, }); }); },
i'm not sure what's causing this, because understanding anytime submit button of modal clicked (#addappt), resourceid set id of whichever slot clicked on. if knows what's causing appreciated.
this html modal
<div id="addeventmodal" class="modal fade" role="dialog"> <div class="modal-dialog"> <!-- modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">sign appointment</h4> </div> <div class="modal-body"> <form id="addappt" class='form-signin'> <label for="inputfirstname" class="sr-only">first name</label> <input type="text" name = "firstname" id="inputfirstname" class="form-control" placeholder="first name" required autofocus> <label for="lastname" class="sr-only">last name</label> <input type="text" name = "lastname" id="inputlastname" class="form-control" placeholder="last name" required> <button id="apptsubmit" type="submit" class="btn btn-primary">add</button> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">close</button> </div> </div> </div>
Comments
Post a Comment