Home>Support>Uncaught TypeError: Cannot read property ‘ajax’ of undefined

Uncaught TypeError: Cannot read property ‘ajax’ of undefined

I’m including the following in footer file of my vantage child theme,

$.ajax({
url: ‘//munchkin.marketo.net/munchkin.js’,
dataType: ‘script’,
cache: true,
success: function() {
Munchkin.init(‘My_Code_…’);
}
});

which produces the following error:
Uncaught TypeError: Cannot read property ‘ajax’ of undefined(index):582 (anonymous function)

Any suggestions as to what I’m doing wrong?

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 9 years, 6 months ago Greg Priday
    Hi, I Work Here

    Hi Chris

    To avoid possible conflicts, WordPress doesn’t have the jQuery $ variable in the global scope. So you’ll need to use the `jQuery` global instead. Something like this:

    jQuery.ajax({
    url: '//munchkin.marketo.net/munchkin.js',
    dataType: 'script',
    cache: true,
    success: function() {
    Munchkin.init('My_Code_...');
    }
    });
    
  2. 9 years, 6 months ago Chris Madsen

    Thanks, man!

  3. 9 years, 6 months ago Greg Priday
    Hi, I Work Here

    Any time :)

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More