我们有以下的问题:通过Ajax-POST呼叫到CFC不起作用
一个CFC-方法是从AJAX称为突然重定向而不是cfcexplorer执行请求的请求。奇怪的是,当我们通过“POST”方法让Ajax调用,这样的问题只发生:
// 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); }
);
制作的“GET”要求完美的作品相同的请求:
// 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); }
);
这是ajax.cfc文件(虚拟文件):
<cfcomponent>
<cffunction name="test" access="remote" returntype="Any" returnformat="JSON">
<cfset j = {}>
<cfset j.data = "this is the data">
<cfreturn serializeJson(j)>
</cffunction>
</cfcomponent>
真正困扰我们的是请求在过去没有工作(我们有很多的代码通过POST和CF-代码都进行Ajax调用预计FORM-数据是存在的,所以我们不能简单地更改为GET)
也许有一些设置已经改变或类似的方法...
我不知道。我们的技术人员处理服务器配置的东西......问题解决后,我得到了上述解释 – Philipp