Solved

saving Javascript variable to coldfusion

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

747 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now