Java script error

hey there,
my website is produciny an error I am not sure what to do about. Looking at the site with Chrome and inspect mode/console, an error message is shown:
JQMIGRATE: Migrate is installed, version 1.4.1
wp-lists.min.js?ver=5.1.1:1 Uncaught ReferenceError: ajaxurl is not defined
at wp-lists.min.js?ver=5.1.1:1
at wp-lists.min.js?ver=5.1.1:1
I googled it but couldn't find anything useful.
Kind regards
Johannes

  • Bamboo Kit
    • Staff

    Hello, Johannes

    I hope you're well today and thank you for reaching out to us.

    I've looked into the Javascript errors and look like that this issue is most likely due to the use of javascript variable to reference the admin-ajax.php file. And the variable “ajaxurl” is not declared for front-end. You should be able to resolve it by declaring this for front-end by putting this code below into your theme's function.php file:

    add_action('wp_head', 'myplugin_ajaxurl');
    
    function myplugin_ajaxurl() {
       echo '<script type="text/javascript">
              var ajaxurl = "' . admin_url('admin-ajax.php') . '";
            </script>';
    }

    However, if this problem still occurs feel free to contact us anytime via this ticket :slightly_smiling_face:

    Kind regards,
    Bamboo

  • Bamboo Kit
    • Staff

    Hello, Johannes

    Thank you for the reply.

    I've looked into your problem and test it from my end, but can't replicate any errors anymore in the console. Everything seem to work perfectly fine, however, in this case I believe that it's a cache issue from your end.

    This is your site from my end :

    So in order to fix that please clear the browser cache and then try to reload the page again.
    If it still happen please try to open your site in incognito mode and see does it still happen.

    I found this page and it was very helpful for clearing the browser caches, you can check it out, hopes it helps:https://www.refreshyourcache.com/en/home/

    I recommend flushing all caches and not only browser cache because this could be coming from some page/static cache or even our from hosting object cache.

    If clearing caches didn't help can you provide us with some additional information:
    - Exact version of OS and Chrome
    - What are console errors are you getting
    - Screenshot

    By the way please let me know where did you add the custom code because I didn't see a child-theme.

    However, if the problem still occurs, feel free to contact us anytime in this ticket.

    Kind regards,
    Bamboo

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.