Uncaught ReferenceError: $ is not defined

Permalink Browser Info Environment
Thanks for publishing this great add-on for free. Unfortunately for me, I get an "Uncaught ReferenceError: $ is not defined" javascript error when I am not logged in to my site. I suspect this is because when the user is not logged-in, I concatenate and minimise all the JS libraries, and load them at the foot of the page to speed up the site (I also use sass and gulp). I'm no JS expert but I'm guessing that the error is because your add-on script uses JQuery, which is not loaded when your script runs.

I note your comments about needing to load your script in the page due to caching issues, so I'm wondering if you know of any easy solution to my problem? For example, are you using JQuery for much more than ID targeting and if so, could these few lines be replaced with vanilla JS?

Type: Pre-Sale
Status: Resolved
View Replies:
losttheplot replied on at Permalink Reply
A colleague has helped me solve this issue by pointing me to this SO thread...

http://stackoverflow.com/questions/799981/document-ready-equivalent...

Might I suggest that you consider adding the wrapper to your add-in code.

Thanks again for publishing your work :)
Advite replied on at Permalink Reply
Advite
Hi,

Sorry I was unable to answer your question yesterday as I am currently away on holiday until the 15th.

I'm glad to hear that you have managed to sort out the issue and I will take a look at the SO link you provided and apply any necessary updates.

Any other questions, please feel free to contact me again and I will try my best to get back to you as fast as possible.

Regards,
Adam

concrete5 Environment Information

# concrete5 Version
Core Version - 5.7.5.8
Version Installed - 5.7.5.8
Database Version - 20160412000000

# concrete5 Packages
Styled Maps (1.2.0), Vivid Store (3.1.4).

# concrete5 Overrides
[snip] ...far too much to post here.

# concrete5 Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache/2.4.6 (CentOS)

# Server API
apache2handler

# PHP Version
5.6.23

# PHP Extensions
apache2handler, apc, apcu, bz2, calendar, Core, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gd, geoip, gettext, hash, iconv, igbinary, imap, intl, json, ldap, libxml, mbstring, mcrypt, memcache, mhash, mysql, mysqli, mysqlnd, openssl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, posix, redis, Reflection, session, shmop, SimpleXML, soap, sockets, SPL, sqlite3, ssh2, standard, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, Zend OPcache, zip, zlib.

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 1024M
post_max_size - 8M
sql.safe_mode - Off
upload_max_filesize - 25M
ldap.max_links - Unlimited
memcache.max_failover_attempts - 20
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
opcache.max_accelerated_files - 4000
opcache.max_file_size - 0
opcache.max_wasted_percentage - 5

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.