Solved

saving Javascript variable to coldfusion

Posted on 2012-03-29
6
245 Views
Last Modified: 2013-11-20
Here is my code.
What I am wanting to do is save the javascript variable to a coldfusion variable.
say using <cfset javaid = ?>  Any help is appreciated.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Main</title>
<script type="text/javascript">

function getParent(){

alert(parent.location);

}

</script>
</head>

<body>
<script type="text/JavaScript">
<!--


document.write(parent.location)

//-->
</script>
<br />


IP Address: <cfoutput>#CGI.REMOTE_ADDR#</cfoutput><br />
Path:<cfoutput>#CGI.SERVER_NAME##CGI.SCRIPT_NAME#</cfoutput><br />
Query:<cfoutput>#CGI.QUERY_STRING#</cfoutput><br />


</body>
</html>
0
Comment
Question by:rbm1tch3ll
  • 2
6 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 37783271
saving Javascript variable to coldfusion

I think you're confused about client vs server side code.  You can't execute CF code from javascript. Javascript runs on the client (browser) and CF runs on the server. Neither one knows anything about the other.  To communicate with the CF server from javascript you need to submit another http request, such as using ajax, submitting a <form>, etc...

What's your ultimate goal in english, not code?
0
 
LVL 4

Expert Comment

by:sandy12879
ID: 37796077
try using cfwddx.
0
 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
ID: 39658267
I've requested that this question be deleted for the following reason:

The question has either no comments or not enough useful information to be called an "answer".
0
 
LVL 52

Expert Comment

by:_agx_
ID: 39658268
> save the javascript variable to a coldfusion variable

The answer is ID: 37783271 -  you can't.

Client side code executes after server side code is finished. To run more server side code you must submit a new request.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question