This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Uncaught TypeError: Cannot read property ‘ajax’ of undefined

Resolved 3 replies premiumthemetheme-vantage
10 years ago · Last reply by Greg Priday 10 years ago

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.

Need fast email support? Get SiteOrigin Premium

Replies

3
  1. Greg Priday Staff 10 years, 11 months ago

    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. Chris Madsen 10 years, 11 months ago

    Thanks, man!

  3. Greg Priday Staff 10 years, 11 months ago

    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.

Have a different question or issue?

Start New Thread