CFloop in Javascript function...pls help urgent
<script type="text/Javascript">
function XYZ(group_id)
{
switch(group_id)
{
<cfloop query = "GetProgramAuthGrpRouting">
case '#GetProgramAuthGrpRouting.group_id#':
<cfset variables.user_names = "">
<!--- Get all users belonging to the selected group id --->
<cfquery name="GetGroupUsers" datasource="#request.db_instance#">
select distinct employee_number from dbo.DIV_USER_GROUP_XREF where division =
<cfqueryPARAM value = "#request.Pub.Project.division#"> and group_id =
<cfqueryPARAM value = "#GetProgramAuthGrpRouting.group_id#">
</cfquery>
<!--- Getting the name of the user by passing the employee id to the GetUser custom tag --->
<cfif GetGroupUsers.RecordCount gt 0>
<cfloop query = "GetGroupUsers">
<CF_GetUser
query_name = "GetUser"
employee_number = "#GetGroupUsers.employee_number#">
<cfset variables.user_names = variables.user_names&''&GetUser.employee_name&'\n'>
</cfloop>
<cfelse>
<cfset variables.user_names = 'No users in this routing group\n'>
</cfif>
alert('#variables.user_names#');
break;
</cfloop>
}
}
</script>
Hi all I am new to this community and this is my first post here. So if this is the wrong place for these then pls let me know the right area. Thanks.I have looped over the result set using CFLOOP in javascript function and it is working fine. But I want to know if this can be done since javascript is a client side scripting language and CF is a server side. Is this the right way of coding? Can i use cfloop in a javascript function? Please help me as this is urgent. Thanks in advance.
