Solved

saving Javascript variable to coldfusion

Posted on 2012-03-29
6
246 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 43

Expert Comment

by:Rob
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

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

827 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