1jQuery(document).ready(function($) { 2 jQuery('#excel-upload-form').submit(function(e) { 3 e.preventDefault(); 4 5 var ajaxurl = leads_ajax_object.ajax_url; 6 var file_data = jQuery('#excel_file').prop('files')[0]; 7 var formData = new FormData(this); 8 //formData.append('file', file_data); 9 console.log([...formData.entries()]); // Debug 10 11 jQuery.ajax({ 12 url: ajaxurl, 13 type: 'POST', 14 data: formData, 15 contentType: false, 16 processData: false, 17 success: function(response) { 18 console.log('Upload Response:', response); 19 try { 20 var data = JSON.parse(response); 21 if (data.success) { 22 $('#status-message').html('File uploaded successfully. Processing data...'); 23 $('#processing-status').show(); 24 25 // Process the file 26 jQuery.ajax({ 27 url: ajaxurl, 28 type: 'POST', 29 data: { 30 action: 'process', 31 file_path: data.file_path 32 }, 33 success: function(processResponse) { 34 var processData = JSON.parse(processResponse); 35 var message = 'Imported ' + processData.success + ' records. '; 36 if (processData.errors > 0) { 37 message += processData.errors + ' errors occurred.'; 38 } 39 jQuery('#status-message').html(message); 40 }, 41 error: function() { 42 jQuery('#status-message').html('Error processing file.'); 43 } 44 }); 45 } else { 46 jQuery('#status-message').html('Upload Error: ' + data.message); 47 jQuery('#processing-status').show(); 48 } 49 } catch (e) { 50 jQuery('#status-message').html('Invalid server response: ' + response); 51 jQuery('#processing-status').show(); 52 } 53 }, 54 error: function() { 55 jQuery('#status-message').html('Error uploading file.'); 56 jQuery('#processing-status').show(); 57 } 58 }); 59 }); 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.