HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //var/www/html/WPProfessionalCleaning/wp-content/themes/professional-cleaning/js/contact-form.js
jQuery(document).ready(function ($) {
    $('#contact-form').parsley();

    $('#contact-form').on('submit', function (e) {
        e.preventDefault();
		var theme_directory = "https://professionalcleaning.spericorn.com/wp-content/themes/professional-cleaning";

        if ($(this).parsley().isValid()) {
            var formData = $(this).serialize();

            $.ajax({
                type: 'POST',
                url: ajax_object.ajax_url,
                data: {
                    action: 'send_contact_email',
                    form_data: formData
                },
                beforeSend: function () {
                   $('.submit')
    .prop('disabled', true)
    .text('Submitting...')
    .css('color', 'white'); // Set text color to white

                },
                success: function (response) {
                    if (response.success) {
                        $('#form-response').html('<div class="success-msg" style="color:green;">Message Sent Successfully!</div>');
						setTimeout(function() {
							$('.success-msg').fadeOut(500, function() {
								$(this).remove(); // Removes the element after fade out
							});
						}, 2000);
                        $('#contact-form')[0].reset();
						$('.submit')
    .prop('disabled', false)
    .html('Submit <img src="' + theme_directory + '/img/arrow-right-btn-white.svg" alt="" class="img">')
    .css('color', 'white');

                    } else {
                        $('#form-response').html('<div class="error-msg">' + response.data + '</div>');
						setTimeout(function() {
							$('.success-msg').fadeOut(500, function() {
								$(this).remove(); // Removes the element after fade out
							});
						}, 2000);
						$('.submit')
    .prop('disabled', false)
    .html('Submit <img src="' + theme_directory + '/img/arrow-right-btn-white.svg" alt="" class="img">')
    .css('color', 'white');

                    }
                },
                complete: function () {
                  $('.submit')
    .prop('disabled', false)
    .html('Submit <img src="' + theme_directory + '/img/arrow-right-btn-white.svg" alt="" class="img">')
    .css('color', 'white');

                }
            });
        }
    });
});