Are you enjoying the extensions? Did you like the support? Help others decide.

Leave a review

file Accessing global variables in different js files

More
11 years 2 weeks ago #3432 by mamboze
I've got jquery ui modal dialog working as required in joomla but I've run into another problem. I want to dynamically load the text into the dialog by accessing, in successive dialogs, elements of a js array. This array is globally declared:
var Darray = {};
Darry.array01 = [["text01", "audio01"],
                ....
                ["text10", "audio10"]];
and is accessed by:
jQuery("span.ws_dialog_icon").on("click",function(evnt) {
jQuery("div#ws_dialog").dialog("open");
..... 
var tester = Darray.array01[0][0];    jQuery("div#wsd_text").text(tester.toString());
This works when the global array variable is declared in the same file as the jquery code but not if it is placed in a different file. I'm surprised as I thought global declarations applied throughout the jquery namespace.

Please Log in or Create an account to join the conversation.

More
11 years 2 weeks ago #3433 by admin
Hello,
I don't know if you did already post it there, but you would propbably get an answer in a more general jQuery forum. I do not have an answer for you, I am afraid, as I have not been confronted to this configuration problem before.

Olivier.

Please Log in or Create an account to join the conversation.

More
11 years 2 weeks ago #3434 by mamboze
No problem, thanks

Please Log in or Create an account to join the conversation.