On Tue, Oct 12, 2010 at 1:20 PM, fun and learning <funandlrnn...@gmail.com>wrote:
> > Hi All - > > I am trying to do the following: > > <script language="text/javascript"> > function abc(arg1, arg2) { > <cfquery name="q" datasource=".."> > select * from table1 where col1 = arg1 > </cfquery> > .................. > } > > </script> > > Is it possible to pass javascript arguments to a coldfusion query which is > in turn present in the javascript block? > ColdFusion runs on the server. JavaScript runs on the client. By the time the browser has rendered the page, ColdFusion has done its duty and is probably hanging out smoking a cigarette or using the little application server room. You can output CF variables to JS just like you do to HTML... <script type="text/javascript"> var myName = "<cfoutput>#myName#</cfoutput>"; </script> ... but it's not a two-way conversation (much like my conversations with my wife). If you want them to talk to each other, you need to introduce AJAX into the equation. So short answer is, no... a JavaScript variable can't be used to manipulate a ColdFusion variable (but the converse works a treat), without utilizing AJAX. And maybe worth noting that the "language" attribute of the <script> tag is deprecated in favor of "type". -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338093 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm