Improper way of adding JS causes 'jQuery is undefined'
seutje - November 3, 2009 - 13:59
| Project: | GMap Module |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
Description
some1 on IRC was getting the 'jQuery is undefined' error caused by this mess:
<?php
$o .= '<script type="text/javascript">'."\n";
$o .= "/* <![CDATA[ */\n";
$o .= 'jQuery.extend(true, Drupal, { settings: '. drupal_to_js(array('gmap' => array($element['#map'] => $map))) ." });\n";
$o .= "/* ]]> */\n";
$o .= "</script>\n";
?>this is not how we add js
attached patch tries to fix that by wrapping it in (function($){ ... })(jQuery) and adding it with a drupal_add_js() with inline as second argument and should apply to current HEAD
| Attachment | Size |
|---|---|
| gmap.patch | 886 bytes |

#1
Yeah, thanks, it was me1 :)
#2
every friggin time I forget status -_-