Reply to topic
Calling a cfc from JS
bash


Joined: 03 Jul 2004
Posts: 15
Reply with quote
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


Joined: 13 Oct 2004
Posts: 43
Location: Seattle
Reply with quote
Can we see the code you are using to do the call?
bash


Joined: 03 Jul 2004
Posts: 15
Reply with quote
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


Joined: 13 Oct 2004
Posts: 43
Location: Seattle
Reply with quote
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


Joined: 03 Jul 2004
Posts: 15
Reply with quote
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

Joined: 07 Mar 2004
Posts: 160
Location: Newark, DE, USA
Reply with quote
May be some kind of perms problem on your local machine. It's probably using the xmlDom object, maybe???
bash


Joined: 03 Jul 2004
Posts: 15
Reply with quote
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

Joined: 24 Jun 2004
Posts: 1129
Location: Colorado
Reply with quote
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
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic