1(function( $ ) { 2 'use strict'; 3 4 /** 5 * All of the code for your public-facing JavaScript source 6 * should reside in this file. 7 * 8 * Note: It has been assumed you will write jQuery code here, so the 9 * $ function reference has been prepared for usage within the scope 10 * of this function. 11 * 12 * This enables you to define handlers, for when the DOM is ready: 13 * 14 * $(function() { 15 * 16 * }); 17 * 18 * When the window is loaded: 19 * 20 * $( window ).load(function() { 21 * 22 * }); 23 * 24 * ...and/or other possibilities. 25 * 26 * Ideally, it is not considered best practise to attach more than a 27 * single DOM-ready or window-load handler for a particular page. 28 * Although scripts in the WordPress core, Plugins and Themes may be 29 * practising this, we should strive to set a better example in our own work. 30 */ 31 32 /** 33 * Compare Ajax 34 * @param {[type]} value [description] 35 * @return {[type]} value [description] 36 */ 37 $("form.horoscopeIdentify").on("submit", function(e) { 38 39 // Stop Multiple form submission 40 e.preventDefault(); 41 //alert("okk"); 42 var thisby = $(this); 43 44 var fileData = thisby.find('input.datepicker').val(); 45 46 /** 47 * Compare form variable 48 * @type {Boolean} 49 */ 50 var isCompareValid = true; 51 52 /** 53 * Form validation 54 * @return {[type]} [description] 55 */ 56 comproductValid(); 57 58 function comproductValid() { 59 isCompareValid = true; 60 if (fileData == "") { 61 isCompareValid = false; 62 thisby.find("input[name='datepicker']").addClass("error"); 63 } else { 64 isCompareValid = true; 65 //alert(productID); 66 thisby.find("input[name='datepicker']").removeClass("error"); 67 } 68 } 69 70 if (isCompareValid == true) { 71 72 /** 73 * Data passing to the server with ajax 74 * @param {[type]} [description] 75 * @return {[type]} [description] 76 */ 77 78 //var form = thisby.closest("form"); 79 80 const formAction = thisby.attr("action"); 81 const formHiddenAction = thisby.find('input[name="action"]').val(); 82 const formWpnonce = thisby.find('input[name="_wpnonce"]').val(); 83 84 var data = { 85 value: fileData, 86 action: formHiddenAction, 87 security: formWpnonce 88 }; 89 90 $.ajax({ 91 type: "POST", 92 dataType: "json", 93 url: formAction, 94 data: data, 95 cache: false, 96 beforeSend: function(xhr) { 97 //form.find("button[type='button']").children("span.spinner-grow").removeClass("d-none"); 98 }, 99 success: function(response) { 100 //alert("ok done"); 101 //console.log(response['data']['reportabug']); 102 103 104 const el0 = document.querySelectorAll('ul.horoscopeSunSign li'); 105 106 for (let i = 0; i < el0.length; i++) { 107 el0[i].classList.remove("horoscopeSelect"); 108 } 109 110 111 // â Get first element that has data-id attribute set 112 const el1 = document.querySelector('[data="'+response['data']['reportabug']+'"]'); 113 el1.classList.add('horoscopeSelect'); 114 115 }, 116 complete: function(xhr, textStatus) { 117 //form.find("button[type='button']").children("span.spinner-grow").addClass("d-none"); 118 } 119 }); 120 }; 121 // Stop form submission 122 //return false; 123 }); 124 125})( jQuery );
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.