1jQuery(document).ready(function ($) { 2 function submitForm (form) { 3 // console.log('Ajax URL:', home_values_ajax.ajax_url); 4 // console.log('Nonce:', home_values_ajax.nonce); 5 // console.log('Form data:', form.find('form').serialize()); 6 $.ajax({ 7 type: 'POST', 8 dataType: 'html', 9 url: home_values_ajax.ajax_url, 10 data: { 11 action: 'home_value_search_form', 12 security: home_values_ajax.nonce, 13 form_data: form.find('form').serialize() 14 }, 15 success: function (response) { 16 // Remove the 'hv-form-loading' class when the request is successful 17 $('#8b-home-value').removeClass('hv-form-loading'); 18 19 form.html(response); 20 initializeNewForm(); 21 }, 22 error: function (e) { 23 // Remove the 'hv-form-loading' class when an error occurs 24 console.log(e); 25 $('#8b-home-value').removeClass('hv-form-loading'); 26 27 alert('An error occurred. Please try again.'); 28 } 29 }); 30 } 31 32 function initializeNewForm () { 33 $('body').off('submit', '#8b-home-value form'); 34 $('body').on('submit', '#8b-home-value form', function (e) { 35 e.preventDefault(); 36 const errorMessage = document.getElementById('8b-errorMessage'); 37 // Add the 'hv-form-loading' class before making the AJAX request 38 $('#8b-home-value').addClass('hv-form-loading'); 39 setTimeout(function () { 40 console.log('submitting form'); 41 // check if address updated 42 if (window.addressUpdated) { 43 if (errorMessage) errorMessage.style.display = 'none'; 44 // errorMessage.style.display = 'none'; 45 submitForm($('#8b-home-value')); 46 } else { 47 // Remove the 'hv-form-loading' class when an error occurs 48 $('#8b-home-value').removeClass('hv-form-loading'); 49 if (errorMessage) { 50 errorMessage.innerHTML = 'Please select a valid address from the suggestions.'; 51 errorMessage.style.display = 'block'; 52 } 53 initializeNewForm(); 54 } 55 }, 1000); 56 }); 57 } 58 59 initializeNewForm(); 60});
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.