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.
Need fast email support? Get SiteOrigin Premium
Replies
3Hi 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_...'); } });Thanks, man!
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.