Monday 12 May 2008 9:23:36 pm - 3 replies
Hi!
Assume the following piece of code (I have truncated the original code), what I would like to do is to add to the EZ variable $mynodo the value of the JS variable nodeID.
How can this be done?
take into consideration that If I use something like:
$mynodo={literal}nodeID{/literal}
It will not work, instead it will print out the text "nodeID" within the JS code.
I have read in the forum several forum discussions about asigning an Ez variable to a javascript (using LITERAL), but this is the opposite, a JS variable to an EZ variable....
{literal}
<script language="JavaScript" type="text/javascript">
function MyOnNodeOpen (nodeID, state)
{
{/literal}
{def $my_node = array()
$mynodo=XXXXXX
}
{literal}
}
</script>
</literal>
thanks
Modified on Monday 12 May 2008 9:24:57 pm by Jorge estévez
Tuesday 13 May 2008 8:31:11 am
Hi,
You can't assign JS variable to template variable. JS is client side technology. It will always run after the template code is executed.
Perhaps you can describe better what you want to do?
Modified on Tuesday 13 May 2008 8:32:02 am by Łukasz Serwatka
Thursday 24 May 2012 10:34:49 am
Quote from Łukasz Serwatka :Hi,
You can't assign JS variable to template variable. JS is client side technology. It will always run after the template code is executed.
Perhaps you can describe better what you want to do?
I have the same problem, I want to get url adress from current page by jquery and paste it to ez publish variable:
<script>
{literal} if(window.location.hash){
var hash = window.location.hash.substring(1);
// hash found
}
else { // No hash found
alert('no hash'); }
{/literal}
</script>
{def $date_year='$hash'}
{def $date_month='$hash2'}
You must be logged in to post messages in this topic!