我无法让Railo在测试页面上使用新的CFC并且在错误控制台中继续“未定义Railo”
错误控制台突出显示此部分:
var _Railo_proxytest = Railo.ajaxProxy.init('/proxytest.cfc','proxytest');
Code CFC:
<cfcomponent>
<cffunction name="test1" access="remote" returntype="string" output="no">
<cfargument name="name" type="string" required="yes" default="Nameless">
<cfreturn "#areguments.name#">
</cffunction>
</cfcomponent>
Code CFM:
<cfajaxproxy cfc="proxytest" jsclassname ="proxytest">
<script>
var myProxy = new proxytest();
function runProxy() {
var name = document.getElementById("name").value;
var results = myProxy.sayHello(name);
}
</script>
<form>
<input type="text" id ="name">
<input type="button" onclick="runProxy()" value="Run">
</form>
答案 0 :(得分:0)
试试这样:
var proxytest = Railo.ajaxProxy.init('/proxytest.cfc');
答案 1 :(得分:0)
您的示例代码中有拼写错误:<cfreturn "#areguments.name#">
应为<cfreturn "#arguments.name#">
此外,您发布的代码不会加起来。您正在从Javascript调用函数sayHello()
,但CFC没有此函数。发布实际代码通常是明智的,而不是重写。
如果直接从浏览器拨打/proxytest.cfc?method=test1&name=MyName
会怎样?