Skip to main content
Inspiring
July 29, 2008
Question

pass query result as parameter to javascript

  • July 29, 2008
  • 1 reply
  • 551 views
Hello,

I'm a beginner with javascript, so (maybe) sorry for this question.

Is it possible to use a query result as parameter in a javascript function
for example like this?

<cfquery name="select_data">
select name from user_table
</cfquery>

<script language="javascript">
function(#select_data.name#)
{
...
}
</script>

Background is: I have to validate an input field with some values which are saved in a database table.
This values can be dynamic , so I don't want to put this values into the cfm-file.

Any ideas?

Claudia

    This topic has been closed for replies.

    1 reply

    Inspiring
    July 29, 2008
    Each column in a cf query is effectively a 1D array. You can use the toscript function to send this array to js.