I have came across a question when I am doing Intersystem Cache Server Page with Javascript.
Here is my Sample Code:
Case 1:
<script language="Javascript">
function test1(){
var val = 0;
#server(..Set())#;
alert(val);
}
</script>
<script language="Cache" method="Set">
Write "val = 50;"
</script>
In this case, when the function test1()
is called, the value = 0 and it is a local variable.
Case 2:
<script language="Javascript">
function test1(){
#server(..Set())#;
alert(val);
}
</script>
<script language="Cache" method="Set">
Write "val = 50;"
</script>
In this case, when the function test1()
is called, the val = 50 and value is now a global variable.
So my questions are:
You can't just generate javascript code on server side this way. You can return one value from this method and get it back in Javascript.
<script language="Javascript">
function test1(){
var val = #server(..Set())#;
alert(val);
}
</script>
<script language="Cache" method="Set">
quit 50
</script>