Home
TeamSite
calling javascript function from perl
cheeku
i need a method to call a javascript function fom an executing ipl.
the scenario is as follows:
i make a call to an ipl using callserver from my js associated with the DCT, now the ipl after some processing needs to return a string to the calling js. currently this is being done in the ipl using the following code:
print <<"EOS";
<html>
<head>
<script language="javascript">
</script>
</head>
<body onload='parent.getScriptFrame().populateDCT("$str");' >
</body>
</html>
EOS
The peformance of this code is not good. Is there any other way to return a string from ipl to js.
Find more posts tagged with
Comments
Dwayne
There is no direct "call" type linkage between your perl script (which is run on the server) and the JavaScript code, which is run on the client. What you're doing is pretty much the only way available that I know of.
You could improve performance slightly by invoking the
parent.getScriptFrame().populateDCT("$str");
line inside the
SCRIPT
tag, rather than as an
onLoad
action of the
BODY
tag. The reason for using the
onLoad
attribute is to ensure that the entire page is loaded before the code is executed. It doesn't look like you care about that in this case.
However, that would be a
very
slight improvement. You'd probably see more improvement by looking at the implementation of the
populateDCT
function.
--
Current project: TS 5.5.2/6.1 W2K