我必须从远程访问点调试Ajax Coldfusion8应用程序,并且很难完成任何工作。
系统在本地主机上运行得很好,但是在生产服务器上,我没有任何地方可以加载页面,但是所有Ajax请求都会被遗忘(提交错误)而不会触发Cold聚变错误。
我的AJAX设置如下:
1)。设置
$(document).on( "click", '.su, .cu' , function() {
var form = $(this).closest('form'),
switcher = form.find('input[name="form_sub"]').val(),
service = "../serve/form_user.cfc",
method = "process",
returnformat = "JSON",
targetUrl = "",
formdata = form.serialize()+"&method="+method+"&returnformat="+returnformat,
successHandler = function() {
alert("hello")
};
ajaxFormSubmit( form, service, formdata, targetUrl, successHandler, "no" );
return false;
});这两个文件都是从application.cfc映射的,如下所示:
THIS.mappings["/controllers"] = GetDirectoryFromPath( GetCurrentTemplatePath() ) & "controllers";
THIS.mappings["/serve"] = GetDirectoryFromPath( GetCurrentTemplatePath() ) & "services";类型cfc扩展到form_switch。
// user cfc
<cfcomponent extends="controllers.form_switch" output="false">
...
</cfcomponent>form_switch本身完成了type.cfc中的所有基本工作,如验证和调用数据库提交。看起来是这样的:
<cfcomponent output="false" hint="switchboard for form handling">
...
// function called by AJAX
<cffunction name="Process" access="remote" returntype="struct" output="false">
<cfset var LOCAL = {} />
<cfset LOCAL.Response = { Success = true, Errors = [], Data = "" } />
// set form data
<cfif IsStruct( ARGUMENTS[ 1 ] )>
<cfset THIS.SetFormData( ARGUMENTS[ 1 ] ) />
<cfelse>
<cfset THIS.SetFormData( ARGUMENTS ) />
</cfif>
// validate
<cfset LOCAL.Response.Errors = THIS.Validate() />
// commit
<cfif ArrayLen( LOCAL.Response.Errors )>
<cfset LOCAL.Response.Success = false />
<cfset LOCAL.Response.Errors = serializeJSON(LOCAL.Response.Errors)>
<cfelse>
<cftry>
<cfset LOCAL.Response = THIS.Commit() />
<cfcatch>
<cfset LOCAL.Response.Success = false />
<cfset LOCAL.Response.Errors = [["server_error","commit error"]] />
</cfcatch>
</cftry>
</cfif>
<cfreturn LOCAL.Response />
</cffunction>
</cfcomponent>我不知道为什么它不起作用,更糟糕的是,我猜是盲目的,为什么?
ajax返回“提交错误”,所以我将访问*form_switch*。
问题:,我如何调试这个?
我试过:
转储到屏幕>不工作,因为我使用的是AJAX。
将文件转储到文件(我有服务器的完整路径,我可以访问服务器,所以我设置了一个dump.txt并尝试
<cfdump output="F:\full\path\to_root\dump.txt" label="catch" var="hello"> 但这给了我一封505错误的电子邮件
Diagnose: An error occurred when performing a file operation write on file F:\full\path\to_root\dump.txt我不能使用CFAdmin调试,因为我无法从远程访问CFAdmin。
我还能做什么?而且如果有人知道问题出在哪里..。答案也是欢迎的..。必须是一些基本的东西,比如混乱的映射,或者在服务器上没有某种用户隐私,...I假设?
谢谢!
是Coldfusion8和MySql 5.0.88 .生产是MySQL 5.5,但我认为这是另一个问题。
编辑
好的。我必须使用e:\和E:\从application.cfc写到application.cfc。但是它仍然不能从form_switch中运行。
发布于 2012-07-06 18:16:15
您是否尝试过在浏览器中直接调用cfc方法,使用url参数,而不是使用AJAX中的post?
在渔获物中插入一个cfdump。
像这样叫你的cfc:http://yourdomain.com/serve/forms users.cfc?method=process&arg1=qwe&arg2=963
这将给出方法的结果或错误的转储。
发布于 2012-07-06 17:11:12
基本问题确实..。
E:\ != e:\https://stackoverflow.com/questions/11366477
复制相似问题