| Server IP : 13.126.101.145 / Your IP : 216.73.216.63 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ip-11-115-0-196 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 10:54:48 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 8.3.17 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/rentals_updated/wp-content/plugins/Sell Enquiry/ |
Upload File : |
// sell-enquiry.js
jQuery(document).ready(function($) {
// Use event delegation to handle submit for dynamic forms
$(document).on('submit', '#leadCreateForm', function(e) {
e.preventDefault();
$('#feedback').html('<p>Submitting...</p>');
// Validate form
var formData = new FormData(this);
formData.append('action', 'save_sell_enquiry');
formData.append('nonce', sellEnquiry.nonce);
$.ajax({
url: sellEnquiry.ajaxurl,
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
$('#leadCreateForm #feedback').html(
'<p style="color:green;">Your enquiry has been submitted. Our team will get in touch shortly.</p>'
);
// Reset form
document.getElementById("leadCreateForm").reset();
$('#enq_images').val('');
$('#imagePreview').empty().hide();
// Refresh page after short delay (so user can see the message)
setTimeout(function() {
location.reload();
}, 100); // 2 seconds
},
});
});
// Handle image preview
$(document).on('change', '#enq_images', function() {
$('#imagePreview').html(''); // Clear old previews
var files = this.files;
if (files) {
$.each(files, function(index, file) {
if (/^image\//.test(file.type)) {
var reader = new FileReader();
reader.onload = function(e) {
$('#imagePreview').append(
'<img src="' + e.target.result +
'" style="width:100px; height:100px; object-fit:cover; border:1px solid #ccc; border-radius:6px;">'
);
};
reader.readAsDataURL(file);
}
});
}
});
});