Avatar of mudbuggle
mudbuggle
Flag for United States of America

asked on 

Multiple Instances of a CFFunction/CFComponent

I am having an issue calling multiple instances of a cffunction. The problem is I intermittenly get null is null errors and some of the data is jumbled. The strange part is the issue is occurring with seperate functions as well.  Any assistance would be greatly appreciated.
I have posted a simplified example of how I am calling the functions below.
I can post the actual code if needed.
example:
<cfcomponent>
<cffunction name="getMenu" returntype="query" access="remote">
<cfaurgument name="menu" required="true">
<cfquery name="getmenu" datasource="someDB">
     SELECT Title, id
     FROM someTable
     WHERE id = #menu#
</cfquery>
<cfreturn getmenu>
</cffunction>
</cfcomponent>
 
<html>
<head>
<script language="javascript" type="text/javascript">
function setMenu(obj)
{
     var params = new Object();
     params.Item = obj;
     http('POST','url.cfc?method=getMenu',makeMenu,params);
}
 
function makeMenu(obj)
{
     for(i=0;i<obj.id.length;i++)
     {
          var alter = document.getElementById(obj.id[i]);
          alter.innerHTML = ob.title[i];
     }
}
</script>
</head>
<body onload="setMenu(1);setMenu(2);setMenu(3);setMenu(4)">
     <div id="1"></div>
     <div id="2"></div>
     <div id="3"></div>
     <div id="4"></div>
</body>
</html>

Open in new window

AJAXColdFusion LanguageJavaScript

Avatar of undefined
Last Comment
mudbuggle

8/22/2022 - Mon