// contact-form.js
jQuery(document).ready(function ($) {
    $('#contact-form').on('submit', function (e) {
        e.preventDefault(); // Stop the form from submitting normally

        // Access the formAction from the localized data
        var formData = $(this).serialize();
        var formAction = contactFormData.formAction; // Access the formAction from localized data

        // Make the AJAX request using formAction
        $.ajax({
            type: 'POST',
            url: formAction,
            data: formData,
            success: function (response) {
                $('#response').html(response);

            },
            error: function (jqXHR, textStatus, errorThrown) {
                var errorMsg = "An error occurred: " + textStatus + " - " + errorThrown;
                $('#response').html(errorMsg);

            }
        });
    });
});