Title: ReferenceError: EM is not defined
Last modified: August 21, 2016

---

# ReferenceError: EM is not defined

 *  Resolved [alienintheheights](https://wordpress.org/support/users/alienintheheights/)
 * (@alienintheheights)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/referenceerror-em-is-not-defined/)
 * After upgrading my site to 3.6 yesterday, the Events Manager plugin, which was
   working, now breaks upon submit:
 *     ```
       ReferenceError: EM is not defined
       url: EM.bookingajaxurl,
       ```
   
 * The error is clearly due to some unnecessary escaping happening in the CDATA 
   tag where the EM variable is defined. As you can see (and I’m only showing part
   of it), everything is overly escaped and as such, the line breaks throw off the
   balance of quotes, creating a parsing error on the EM var itself. Hence, the 
   JS error seen when trying to submit the form.
 *     ```
       <script type='text/javascript'>
       /* <![CDATA[ */
       var EM = {"ajaxurl":"http:\/\/MYSITE.com\/wp-admin\/admin-ajax.php","locationajaxurl":"http:\/\/MYSITE.com\/wp-admin\/admin-ajax.php?action=locations_search"
       .... (ETC)....
       "","bookingInProgress":"Please wait while the booking is being submitted.","tickets_save":"Save Ticket",
       ... (ETC)
       };
       /* ]]> */
       </script>
       ```
   
 * I’m not blaming the plugin. I’m sure it’s a something amiss in the theme template,
   or perhaps in my config. But I’m not a WP expert, so I’m not sure where to look.
   I’m happy to hack code if needed. Just give me a nudge in the right direction.
 * Thanks in advance.
 * [http://wordpress.org/plugins/events-manager/](http://wordpress.org/plugins/events-manager/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [alienintheheights](https://wordpress.org/support/users/alienintheheights/)
 * (@alienintheheights)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/referenceerror-em-is-not-defined/#post-4073224)
 * Figured it out. User error.
 * The wp_head() directive in my theme’s header.php got misplaced inside a pair 
   of style tags, thus the script wasn’t executing. Moved it out and everything 
   was happy again. The escaping I reported is apparently normally (per a WP support
   ticket I found) though Firebug didn’t like it when I copy/pasted it into the 
   console (=red herring).
 * Thanks.
 *  Plugin Support [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * (@angelo_nwl)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/referenceerror-em-is-not-defined/#post-4073225)
 * thanks for the update.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘ReferenceError: EM is not defined’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=1039078)
 * [Events Manager - Calendar, Bookings, Tickets, and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

## Tags

 * [cdata](https://wordpress.org/support/topic-tag/cdata/)

 * 2 replies
 * 2 participants
 * Last reply from: [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/referenceerror-em-is-not-defined/#post-4073225)
 * Status: resolved