Question

We have the following problem:

A CFC-method that is called from AJAX suddenly redirects the request to cfcexplorer instead of executing the request. The strange thing is, that the problem only occurs when we make the ajax call via "POST" method, like this:

// This will return the HTTP Status header:
// Location: http://url.to:80/CFIDE/componentutils/cfcexplorer.cfc?method=getcfcinhtml&name=web.ajax&path=/web/ajax.cfc
$.post(
    "http://url.to/ajax.cfc",
    {method: "test"},
    function(res) { alert("ajax.cfc POST return:"  + res); }
);

Making the same request as "GET" request works perfectly:

// This will call the method "test" of web/ajax.cfc
$.get(
    "http://url.to/ajax.cfc",
    {method: "test"},
    function(res) { alert("ajax.cfc GET return:"  + res); }
);

This is the ajax.cfc file (dummy file):

<cfcomponent>
    <cffunction name="test" access="remote" returntype="Any" returnformat="JSON">
        <cfset j = {}>
        <cfset j.data = "this is the data">
        <cfreturn serializeJson(j)>
    </cffunction>
</cfcomponent>

What really puzzles us is that the request did work in the past (we have a lot of code all making ajax calls via POST and CF-code that expects FORM-data to be present, so we cannot simply change the method to GET)

Maybe there was some setting that has changed or similar...

Was it helpful?

Solution

We did find the solution: There was a problem with our apache server! All POST data got lost before it was forwarded to coldfusion - so the FORM variable was always empty.

After fixing the configuration (which I have no idea how to do...) the problem was solved.

OTHER TIPS

I am using IIS and it works fine doing ajax calls etc. what was the problem with APACHE?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top