![]() |
| Calling a cfc from JS |
|
bash
|
I'm trying to call a cfc from javascript and I keep getting a permissions error. Do I need to have anything set up for this to work? Here is the error:
Error: uncaught exception: Permission denied to call method XMLHttpRequest.open |
||||||||||||
|
|
|||||||||||||
|
kbrocx
|
Can we see the code you are using to do the call?
|
||||||||||||
|
|
|||||||||||||
|
bash
|
Here is the set up code:
<!--- URL that will return WDDX packet containing recordset of film data ---> <cfset FilmComponentURL = "http://myIPaddress/comDirectory/component.cfc?"> <!--- Pass variables to JavaScript ---> <cfoutput> <script type="text/javascript" language="JavaScript"> var FilmComponentURL = "#JSStringFormat(FilmComponentURL)#" </script> </cfoutput> <!--- Include WddxRecordset support ---> <script type="text/javascript" language="JavaScript" src="scripts/wddx.js"></script> <!--- Include WddxDeserializer support ---> <!--- (use special file if browser is IE under Windows ---> <cfif (CGI.HTTP_USER_AGENT contains "MSIE") AND (CGI.HTTP_USER_AGENT contains "Win")> <script type="text/javascript" language="JavaScript" src="scripts/wddxDesIE.js"></script> <cfelse> <script type="text/javascript" language="JavaScript" src="scripts/wddxDes.js"></script> </cfif> And then here is the call and deserialization code: // Add the value to the URL var packetURL = FilmComponentURL + "method=getTable&table=tableToGet&id=" + season; // Fetch the WDDX packet from the URL var packet = httpGetFromURL(packetURL); // Deserialize the packet // The result is a WddxRecordset object called rsVenues var wddxDes = new WddxDeserializer; var rsVenues = wddxDes.deserialize(packet); The code used is from Ben Forta's Advancaed CFWACK book for creating related selects in real time. |
||||||||||||
|
|
|||||||||||||
|
kbrocx
|
Well, the only thing I can think of off the top is are you calling the js from the same namespace as the FilmComponentURL?
So in this example is the calling page in the "http://myIPaddress/" domain? If you're calling the page http://192.168.10.100/comDirectory/component.cfc? from http://www.myDomain.com/comDirectory/callingPage.cfm js won't allow it even if they are in the same directory. If that's not it I'm at a loss. |
||||||||||||
|
|
|||||||||||||
|
bash
|
Well they are in the same domain, but different directories. Could it be because I am using the ip address instead of the domain name?
|
||||||||||||
|
|
|||||||||||||
|
byron
Forum Admin
|
May be some kind of perms problem on your local machine. It's probably using the xmlDom object, maybe???
|
||||||||||||
|
|
|||||||||||||
|
bash
|
It won't run on the HMS server. I have a mpaaing set up for the folder the cfc is in; would I need a special perm set up to use the xmlDOM as I believe that is what it is using. I know it is using WDDX packets.
|
||||||||||||
|
|
|||||||||||||
|
loftboy
Forum Regular
|
im not so sure u can do that
why dont u just create the cfobject which in turns runs it into js anyway? email raymond camden at www.camdenfamily.com (i think) he rules cfc use |
||||||||||||
|
|
|||||||||||||
| Calling a cfc from JS |
|
||
|


