SHARE
TWEET

Untitled

a guest Feb 14th, 2020 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var modalCalendar_request;
  2.   // Show modal
  3.   $('#modalCalendar').on('show.bs.modal', function (event) {
  4.     // modal & the event triggering the modal
  5.     var modal = $(this)
  6.     var e = $(event.relatedTarget)
  7.     // Update calendar
  8.     if (e.data('id')) {
  9.       modal.find('.modal-title').text('{{ __("Edit calendar") }} ' + e.data('id'));
  10.       modal.find('.modal-dialog form').attr('action', '{{ url_for("calendar.sources.api01") }}/' + e.data('id') );
  11.       modal.find('.modal-body input[name="name"]').val(e.data('name'));
  12.       modal.find('.modal-body input[name="uri"]').val(e.data('uri'));
  13.       modalCalendar_request = 'PUT';
  14.       alert(modalCalendar_request);
  15.     }
  16.     // New calendar
  17.     else {
  18.       modal.find('.modal-title').text('{{ __("New remote calendar") }}');
  19.       modal.find('.modal-dialog form').attr('action', '{{ url_for("calendar.sources.api01") }}/');
  20.       modal.find('.modal-body input[name="name"]').val('');
  21.       modal.find('.modal-body input[name="uri"]').val('');
  22.       modalCalendar_request = 'POST';
  23.     }
  24.   });
  25.  
  26.  
  27.   // Post (new) data, modify current page
  28.   $("#calendar_form").ajaxSubmit({
  29.     data: function() {
  30.       alert('snd' + modalCalendar_request);
  31.       return $(this).serialize();
  32.     },
  33.     headers: {
  34.       "X-Http-Method-Override": modalCalendar_request
  35.     },
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top