Try creating an IFRAME and have your page which wants the client vars call
the iframe like this:
<cfoutput>
<script language="javascript">
function getClientVars(clienvar){
document.myiframe.location.href='www.mywebsite.com/getclientvars.cf
document.myiframe.location.href='www.mywebsite.com/getclientvars.cfm?request
edvar='+clientvar+'&cfid=#cfid#&cftoken=#cftoken#'
}
</script>
</cfoutput>
Then in the getclientvars.cfm template just set something like this:
<cfparam name="requestedvar" default="empty">
<cfoutput>
<cfif isdefined("client.#requestedvar#")>
<cfset x=evaluate("client.requestedvar")>
<cfelse>
<cfset x="undefined">
</cfif>
</cfoutput>
<html>
<head>
</head>
<!--- call the parent frame (or name it absolutely) and
tell it we have finished loading and the variable is set.
Note: you could also dump the var in a hidden form
field... --->
<body onload="finishedloading('#requestedvar#','#x#');">
</body>
</html>
Then put this in the calling template:
function finishedloading(VarName,VarValue){
alert('The request client var '+Varname+' is '+VarValue+'.');
// eval('var '+varName+' '+\''+Varvalue+\'') }
You might have to play with it a bit, and I wrote this in my email so, it
may have some syntax mistakes in it. You might also consider passing the
name of a function to call on the way back as part of the initial argument.
Then you can do something a little more useful with the result and unique
for each type of call made.
Brook Davies
maracasmedia inc.
At 06:20 PM 09/08/02 -0400, you wrote:
>I got that, but how do I call the other frame as a read only and then pull
>the data back to the first frame to report back to the caller.
>
>
>
>-----Original Message-----
>From: Dan Haley [mailto:[EMAIL PROTECTED]]
>Sent: Friday, August 09, 2002 6:04 PM
>To: CF-Talk
>Subject: RE: Callling Client or Session varibles from a javascript
>
>
>Sounds like you've got the Javascript figured out pretty well, so the
>following should give you an idea of how to get it back ... this is from
>CF4.5, not sure how things have changed ... tried to find the WDDX
>serializer and deserializer JS objects out on the web and most of the links
>were broken ...
>
><cfset x = structnew()>
><cfset x.myvar = 8>
><cfwddx action="CFML2JS" input="#x#" output="y" toplevelvariable="z">
><script language="javascript">
><cfoutput>#y#</cfoutput>
></script>
>
>Dan
>
>-----Original Message-----
>From: Matthew Friedman [mailto:[EMAIL PROTECTED]]
>Sent: Friday, August 09, 2002 3:01 PM
>To: CF-Talk
>Subject: Callling Client or Session varibles from a javascript
>
>
>I have a need to read and set client or session variable from javascipt.
>
>I am working on a project that has to intergrate content that uses a
>standard set of calls to an api to send and recieve data.
>
>I have set up the system to use a frame with the API name to recieve the
>calls and I can catch request and send them back to the object calling, but
>I need the ablity to call and update client or session variabled.
>
>Setting the varibles is easy, I set up another frame and the first frame
>calls the second frame that runs cf code to process the request.
>
>The question is how do I retrieve "get" client varible information back from
>the second frame to return back to the object.
>
>Any help would be great.
>
>Matt
>
>
>
>
>
>
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists