# mxchat-basic/1.3/js/embedding-check.js

MxChat – AI Chatbot &amp; Content Generation for WordPress, version 1.3. 27 lines.

- Page: https://pluginprobe.com/plugins/mxchat-basic/1.3/code/js/embedding-check.js
- Raw: https://pluginprobe.com/plugins/mxchat-basic/1.3/raw/js/embedding-check.js
- Modified: 2024-11-07T15:22:56+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/mxchat-basic/1.3/code/js/embedding-check.js#L10-L20`.

```javascript
document.addEventListener('DOMContentLoaded', function() {
    var urlParams = new URLSearchParams(window.location.search);
    if (urlParams.has('embedding_failed')) {
        alert('Failed to generate embedding for the content. Please try submitting again.');
    }

    var sitemapForm = document.getElementById('mxchat-sitemap-form');
    
    // Only proceed if the sitemapForm element exists
    if (sitemapForm) {
        var loadingSpinner = document.getElementById('mxchat-sitemap-loading');
        var loadingText = document.getElementById('mxchat-loading-text');
        var sitemapUrlField = document.getElementById('sitemap_url');
        var submitButton = sitemapForm.querySelector('input[type="submit"]');

        sitemapForm.addEventListener('submit', function() {
            // Hide the form fields
            sitemapUrlField.style.display = 'none';
            submitButton.style.display = 'none';

            // Show the loading spinner and text
            loadingSpinner.style.display = 'flex';
            loadingText.style.display = 'block';
        });
    }
});

```
