Javascript ajaxsubmit给了我一个文本错误
我有一个使用Coldfusion和jquery的页面,我正在尝试使用ajaxSubmit提交表单。我发现有些文字有错误,我不明白为什么 我已经在创建了一个演示页面,它说明了我的问题 文件SaveInlineEdit_dbg.cfm存在,但其内容为空 使用第一个链接访问此页面时,会出现以下错误: 禁止您没有访问权限 /inc/SaveInlineEdit_dbg.cfm在此服务器上 此外,在尝试查找时遇到404 Not Found错误 使用ErrorDocument来处理请求 当您使用第二个链接访问页面时,一切正常。唯一的区别是以表格形式提交的文本 我希望有人能给我一些启示,帮助我解决这个问题 下面是debug_edit.cfm中的代码副本Javascript ajaxsubmit给了我一个文本错误,javascript,jquery,coldfusion,jquery.form.js,Javascript,Jquery,Coldfusion,Jquery.form.js,我有一个使用Coldfusion和jquery的页面,我正在尝试使用ajaxSubmit提交表单。我发现有些文字有错误,我不明白为什么 我已经在创建了一个演示页面,它说明了我的问题 文件SaveInlineEdit_dbg.cfm存在,但其内容为空 使用第一个链接访问此页面时,会出现以下错误: 禁止您没有访问权限 /inc/SaveInlineEdit_dbg.cfm在此服务器上 此外,在尝试查找时遇到404 Not Found错误 使用ErrorDocument来处理请求 当您使用第二个链接访
<cfparam name="url.dbg" default="1">
<link type="text/css" href="jqueryui/css/smoothness/jquery-ui.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js" type="text/javascript"></script>
<script type="text/javascript">
window.jQuery || document.write('<script src="jqueryui\/1.12.2\/jquery.min.js" type="text\/javascript"><\/script><script src="jqueryui\/js\/jquery-ui-1.11.4.min.js" type="text\/javascript" ><\/script>;');
</script>
<script src="jqueryui/js/jquery.form.min.js"></script>
<div id="formstate"></div>
<form name="InlineForm" id="InlineForm" style="margin:0px;" action="/inc/SaveInlineEdit_dbg.cfm" method="post" enctype="multipart/form-data">
<cfif url.dbg eq 1>
<input type="hidden" name="PageContent" id="PageContent" size="200" value='<p>CONVERT MORE with search engine optimization and responsive design.</p>' /><br>
<input disabled="disabled" type="text" name="PageContent_disp" id="PageContent_disp" size="200" value='<p>CONVERT MORE with search engine optimization and responsive design.</p>' /><br>
<cfelse>
<input type="hidden" name="PageContent" id="PageContent" size="200" value='<p>responsive design</p>' /><br>
<input disabled="disabled" type="text" name="PageContent_disp" id="PageContent_disp" size="200" value='<p>responsive design</p>' /><br>
</cfif>
</form>
<script type="text/javascript">
var optionsSaveDoc =
{
error: errorHandlerSaveDoc,
success: callbackSaveDoc
};
//callback handler for form submit
$("#InlineForm").submit(function(e)
{
// submit the form
$(this).ajaxSubmit(optionsSaveDoc);
// return false to prevent normal browser submit and page navigation
e.preventDefault(); //STOP default action
return false;
});
$("#InlineForm").submit(); //Submit the FORM
function callbackSaveDoc(responseText, statusText, xhr, $form)
{
$('div#formstate').html('It worked');
}
function errorHandlerSaveDoc(msg)
{
$('div#formstate').html(msg.responseText);
console.log(msg.responseText);
}
</script>
window.jQuery | | document.write(“;”);
var选项SAVEDOC=
{
错误:errorHandlerSaveDoc,
成功:callbackSaveDoc
};
//表单提交的回调处理程序
$(“#InlineForm”).submit(函数(e)
{
//提交表格
$(此).ajaxSubmit(选项SaveDoc);
//返回false以防止正常的浏览器提交和页面导航
e、 preventDefault();//停止默认操作
返回false;
});
$(“#InlineForm”).submit()//提交表格
函数callbackSaveDoc(responseText、statusText、xhr$form)
{
$('div#formstate').html('It worked');
}
函数errorHandlerSaveDoc(msg)
{
$('div#formstate').html(msg.responseText);
console.log(msg.responseText);
}
怪异。。如果这有帮助的话,当url中也有dgb=1
时,它实际上会显示权限错误,因此它似乎与具有此值(默认值)时发生的情况有关。当您将第二个备选方案的2个输入复制到第一个备选方案(在
中)时,是否仍为403?只有当我试图提交到表单的文本包含以下内容时,才会发生错误:使用搜索引擎优化和响应性设计转换更多内容。。所有其他文本都很好。我只是使用参数url.dbg作为一种方式,使一个页面显示两个不同的版本,其中一个有效,另一个不可用。您是否尝试了其他html标记和/或其他尖括号?其他html标记和/或尖括号有效。出于某种原因,这一特定文本不起作用。之间的其他文本 另外,您是否尝试将$(“#InlineForm”).submit()放入代码>在$(文档)中。准备好了吗?即使这不能解决问题,也不会有什么坏处。。可能在您的选项中使用数据类型:“json”
?似乎默认值是null
,但我不知道它对应什么。。