[BEGINNER] get variable in javascript

Hi,

i have e variable

<e:variable name="varGroups" id="varGroups"
  xmlns:e="http://www.backbase.com/2006/xel"
  xmlns:xi="http://www.w3.org/2001/XInclude">

  <e:data type="application/xml">
    <xi:include href="common/data/groupList_xml.jsp" />
  </e:data>
</e:variable>

<b:dataSource e:behavior="b:localData" dataType="application/xml"
  name="dataSource_groups"
  id="dataSource_groups"
  dataSelect="$varGroups"/>

i want to get element in javascript

<e:script type="application/javascript">
  var myVariable = bb.document.getElementById('varGroups');
  alert(myVariable);
</e:script>

but myVariable is null !
how to get String of my variable ?

cdt,
Arnaud

Re: get XEL variable from javascript

Global variables declared in XEL are available in JavaScript as global variables with corresponding names used in the @name attribute of the XEL variable declaration.

So you can basically do:

<e:script type="application/javascript">
  alert(varGroups);
</e:script>

Note that variable will contain not a string but a XMLDocument object, that you might need to serialize (you asked: "how to get String of my variable") with:

<e:script type="application/javascript">
alert(new XMLSerializer().serializeToString(varGroups));
</e:script>

thanks for your help its

thanks for your help
its work