Zen Cart Logo
Forums / Contribution-Writing Guidelines / when jquery is loaded but seems like it isn't

when jquery is loaded but seems like it isn't

Views: 1,757

Results 1 to 1 of 1
13 Dec 2011, 7:15 PM
#1
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,875
Plugin Contributions:
7

when jquery is loaded but seems like it isn't

This is some info I wished I had found earlier in the day, so hope this helps someone else...

while fiddling with a contribution that uses a jscript_...php file to load two .js files I thought why not just rename the two.js files to jscript_whatever.js and ZC will load them automatically: a whole file saved! How clever that would be!

So I renamed

instant_search.js ->jscript_instant_search.js
jquery.js->jscript_jquery.js

and it would not work.

Although both files got loaded ok, the first function call to jquery failed.

No doubt some of you are chuckling, for the rest of you..

i comes before j:bangin:

so the scripts were loading in aphabetical order and the function was executing before the jquery was loaded.

Renaming to
jscript_instant_search.js
jscript_0jquery.js
fixed it.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...