Solved

saving Javascript variable to coldfusion

Posted on 2012-03-29
6
249 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Boolean 13 51
Call a VB.net function in Javascript 6 52
Drag & Drop Error 5 33
Writing reports to a script 7 33
This article will show, step by step, how to integrate R code into a R Sweave document
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
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.

752 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