cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "WeeZard" <weez...@email.si>
Subject Re: dynamic cocoon.load("...")
Date Tue, 10 May 2005 14:44:12 GMT
Thank you very much. This actualy works :-)

Weez.
----- Original Message ----- 
From: "Guido Casper" <gcasper@s-und-n.de>
To: <users@cocoon.apache.org>
Sent: Tuesday, May 10, 2005 2:04 PM
Subject: Re: dynamic cocoon.load("...")


The way I do it is by declaring a global variable like

   var myFunction;

and than load the script within another function:

   function loadAndRunScript() {
       var x = cocoon.request.get("id");
       cocoon.load("foo"+x+".js");
       myFunction();
   }

The loaded Script looks like:

   myFunction = function() {
       cocoon.sendPage("somePipeline", bizData);
   }

Prior to 2.1.7 it used to work like:

   function myFunction() {
       cocoon.sendPage("somePipeline", bizData);
   }

But now the hack with global variable seems to be necessary (don't know
exactly why, some scoping changes I guess).

Another way may be
http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=106269832307956&w=2
But I didn't try that.

HTH
Guido


WeeZard wrote:

> REPOST
> -----------------------------------------------------------------------------------------------
>
> I got some test.js javascript file with this in it:
>
> var x = cocoon.request.get("id");
> cocoon.load("foo"+x+".js");
>
> When i run test.js for the first time, it works fine. Script engine reads 
> id
> request parameter and loads apropriate foo*.js file.
> But when i reload the page with a different id request parameter, script
> engine just ignores that, and keeps loading previous foo*.js file.
>
> For example,
> my first request: myPage.html?id=1 loads foo1.js,
> my second request: myPage.html?id=2 loads foo1.js, instead of foo2.js !!
>
> Why this isn't working as it should and is there ANY way to dynamicaly 
> load
> external javascript files
>
> Weez
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

-- 
Freundliche Grüße / With kind regards
Guido Casper

S&N AG
Competence Center Open Source
Klingenderstr. 5
D 33100 Paderborn

voice  +49 5251/1581-87
fax    +49 5251/1581-71
eMail  gcasper@s-und-n.de
Web    http://www.s-und-n.de

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message