1jQuery(document).ready(function($) { 2 $('#popUpForm').submit(function(e) { 3 e.preventDefault(); 4 5 // Collect form data 6 var formData = $(this).serialize(); 7 console.log(formData); 8 9 // AJAX request 10 $.ajax({ 11 type: 'POST', 12 url: ajax_object.ajax_url, 13 data: { 14 action: 'process_my_form', 15 formData: formData, 16 }, 17 success: function(response) { 18 // Remove unwanted characters (e.g., "Response: ") 19 var sanitizedResponse = response.replace(/^.*?({.*}).*?$/, '$1'); 20 21 // Parse the JSON response 22 try { 23 var responseData = JSON.parse(sanitizedResponse); 24 25 // Check if there's a redirect URL 26 if (responseData && responseData.confirmation_redirect) { 27 // Redirect to the specified URL 28 window.location.href = responseData.confirmation_redirect; 29 } else { 30 // Handle other cases if needed 31 console.log('Unexpected response:', response); 32 } 33 } catch (error) { 34 console.error('Error parsing JSON:', error); 35 } 36 }, 37 error: function(error) { 38 console.log('Error:', error); 39 40 } 41 }); 42 }); 43});
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.