1$(function() { 2 3 // listener for the location select. 4 $('#location').on('change', function() { 5 6 var location = $('#location').val(); 7 var captcha = $('#captcha-result').val(); 8 9 // reset the datepicker 10 $('#datepicker').datepicker().destroy(); 11 12 13 // Submit the form using AJAX. 14 $.ajax({ 15 type: 'POST', 16 url: '../assets/php/calendarAPI.php', 17 data: { "captcha-result": captcha, "location": location } 18 }) 19 20 .done(function(response) { 21 22 const dates = JSON.parse(response); 23 //var excludedDates = response; 24 25 if(location == 'Walnut Creek') { 26 var days = [0, 2, 4, 5, 6]; 27 } else { 28 var days = [0, 2, 5, 6]; 29 } 30 31 $('#datepicker').datepicker({ 32 disableDaysOfWeek: days, 33 disableDates: dates, 34 //disableDates: ["04/10/2024", "04/11/2024"], 35 minDate: function() { 36 var date = new Date(); 37 date.setDate(date.getDate()+14); 38 return new Date(date.getFullYear(), date.getMonth(), date.getDate()); 39 } 40 }); 41 42 // set the location 43 $('#locationName').attr('value', location); 44 45 // show step 2 46 $('#step2').css("display", "block"); 47 48 // Set the message text. 49 //$('#output').text("Excluded dates: "+dates); 50 51 }) // end .done (success) 52 53 .fail(function(data) { 54 55 // Set the message text. 56 if (data.responseText !== '') { 57 $('#output').text(data.responseText); 58 } else { 59 $('#output').text('Oops! An error occured.'); 60 } 61 62 }); // end .fail 63 64 }); // end on location change 65 66 67 // Get the form. 68 //var form = $('#fundraiserForm'); 69 70 // Get the messages div. 71 var formMessages = $('#formMessages'); 72 73 // Listener for form submit. 74 $('#fundraiserForm').submit(function(event) { 75 76 // Stop the browser from submitting the form. 77 event.preventDefault(); 78 79 // Serialize the form data. 80 //var formData = $('#fundraiserForm').serialize(); 81 82 // change formMessages div to 'processing' class. 83 $(formMessages).removeClass('formError'); 84 $(formMessages).removeClass('formSuccess'); 85 $(formMessages).addClass('formProcessing'); 86 87 // Submit the form using AJAX. 88 /*$.ajax({ 89 type: 'POST', 90 url: $('#fundraiserForm').attr('action'), 91 data: formData 92 })*/ 93 94 $.ajax({ 95 type: 'POST', 96 url: $('#fundraiserForm').attr('action'), 97 data: new FormData(this), 98 contentType: "multipart/form-data", 99 processData: false, 100 contentType: false 101 }) 102 103 .done(function(response) { 104 // change formMessages div to 'success' class. 105 $(formMessages).removeClass('formError'); 106 $(formMessages).removeClass('formProcessing'); 107 $(formMessages).addClass('formSuccess'); 108 109 // Set the message text. 110 $(formMessages).text(response); 111 112 }) 113 114 .fail(function(data) { 115 // change formMessages div to 'error' class. 116 $(formMessages).removeClass('formSuccess'); 117 $(formMessages).removeClass('formProcessing'); 118 $(formMessages).addClass('formError'); 119 120 // Set the message text. 121 if (data.responseText !== '') { 122 $(formMessages).text(data.responseText); 123 } else { 124 $(formMessages).text('Oops! An error occured in processing the form.'); 125 } 126 }); // end .fail 127 128 }); // end form submit 129 130}); // end main function
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.