Coldfusion Jquery Ajax调用-500错误
我知道这个话题已经被打死了。但我无法从我的研究中解决这个问题。我使用的是CF9和jQuery1.8。我尝试在ajax调用中使用cfc,但得到了500个错误。我把它改成了cfm,把url路径翻了个底朝外。我还有很多其他代码没有提供路径(默认为当前文件夹)。开发工具给了我以下的回应Coldfusion Jquery Ajax调用-500错误,jquery,coldfusion,coldfusion-9,cfml,Jquery,Coldfusion,Coldfusion 9,Cfml,我知道这个话题已经被打死了。但我无法从我的研究中解决这个问题。我使用的是CF9和jQuery1.8。我尝试在ajax调用中使用cfc,但得到了500个错误。我把它改成了cfm,把url路径翻了个底朝外。我还有很多其他代码没有提供路径(默认为当前文件夹)。开发工具给了我以下的回应 <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="tex
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>500 - Internal server error.</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}
fieldset{padding:0 15px 10px 15px;}
h1{font-size:2.4em;margin:0;color:#FFF;}
h2{font-size:1.7em;margin:0;color:#CC0000;}
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;}
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;
background-color:#555555;}
#content{margin:0 0 0 2%;position:relative;}
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}
-->
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
<div class="content-container"><fieldset>
<h2>500 - Internal server error.</h2>
<h3>There is a problem with the resource you are looking for, and it cannot be displayed.</h3>
</fieldset></div>
</div>
</body>
</html>
500-内部服务器错误。
服务器错误
500-内部服务器错误。
您正在查找的资源有问题,无法显示。
我可以直接从浏览器发布页面,它可以完美地执行。无500错误,数据更新到数据库。在服务器上找不到任何日志项。
代码片段是
$('##clnoteformdivedit').on('click', function() {
var thisuserid = $(this).parent().find('##ClIndNoteIndivnum').val();
var thisindivnote = $(this).parent().find('##indNote').val();
alert(thisuserid + '--' + thisindivnote);
$.ajax({
type: 'POST',
url: "actUpdateClIndivNote.cfm",
data: 'calllistID=' + <cfoutput>#val(attributes.callListId)#</cfoutput> + '&userid=' + thisuserid + '&IndivNote' + thisindivnote,
error: function(xhr, textStatus, errorThrown) {
// show error
alert(errorThrown);
},
success: function(response1, textStatus, jqXHR) {
$('##clnoteformdivedit').hide();
$('##clnoteformdivdisplay').show();
}
});
});
$('##clnoteformdivedit')。在('click',function()上{
var thisuserid=$(this.parent().find('##ClIndNoteIndivnum').val();
var thisindivnote=$(this.parent().find('##indNote').val();
警报(thisuserid+'--'+thisindivnote);
$.ajax({
键入:“POST”,
url:“actUpdateClIndivNote.cfm”,
数据:“calllistID=”+#val(attributes.calllistID)#+”&userid=“+thisuserid+”&IndivNote'+thisindivnote,
错误:函数(xhr、textStatus、errorshown){
//显示错误
警报(错误抛出);
},
成功:函数(response1、textStatus、jqXHR){
$('##clnoteformdivedit').hide();
$('##clnoteformdivdisplay').show();
}
});
});
ACTUPDATECLINIVNOTE.cfm代码
<cfset attributes.suppresslayout2 = "true">
<cfquery datasource="#request.dsn#" name="updateCLnotes" >
update call_lists_users
set notes = <cfqueryparam cfsqltype="cf_sql_longvarchar" value="#url.IndivNote#">
WHERE UsersID = <cfqueryparam value="#val(url.userid)#" cfsqltype="cf_sql_integer">
and CallListsId = <cfqueryparam value="#val(listfirst(url.callListId))#" cfsqltype="cf_sql_integer">
</cfquery>
更新呼叫列表用户
设置注释=
其中UsersID=
和CallListsId=
您的问题在于此。您正在向actUpdateClIndivNote.cfm发布帖子:
$.ajax({
type: 'POST',
但是,该文件需要URL中的值:
- url.IndivNote
- url.userid
- url.callListId
或者将AJAX请求从type=POST更改为type=GET。或者将您的CFM/CFC更改为在表单范围而不是URL范围中期望值(即
\Form.IndivNote
等)。您的问题在于此。您正在向actUpdateClIndivNote.cfm发布帖子:
$.ajax({
type: 'POST',
但是,该文件需要URL中的值:
- url.IndivNote
- url.userid
- url.callListId
\Form.IndivNote
等)。是否需要
“&IndivNote”+此IndivNote“&IndivNote=”+此IndivNote 请注意,我将
您的期望值设置为调试的默认值。然后你可以把他们带走看看问题。您还可以添加转储以转储URL/表单范围,然后在Chrome开发工具中的XHR请求重播中检查这些转储。您需要吗
“&IndivNote”+此IndivNote“&IndivNote=”+此IndivNote
请注意,我将
您的期望值设置为调试的默认值。然后你可以把他们带走看看问题。您还可以添加转储以转储URL/表单范围,然后只需在Chrome开发工具中的XHR请求重播中检查这些转储。actUpdateClIndivNote.cfm是什么样子的?在浏览器控制台网络选项卡中检查请求本身,以查看发送的内容是否符合您的预期。在cfm文件中执行form
的cfdump
并中止,然后在请求-响应的主体中检查;我添加了actUpdateClIndivNote.cfm代码。查利特夫;我知道代码是有效的。我在浏览器中运行它,在url中传递参数,它更新正确,没有错误。是的,如果在url中传递参数,它会起作用,因为您直接在url范围中引用它们。您的AJAX请求使用post,因此它们位于表单范围内。actUpdateClIndivNote.cfm是什么样子的?请在浏览器控制台的“网络”选项卡中检查请求本身,以查看发送的内容是否符合您的预期。在cfm文件中执行form
的cfdump
并中止,然后在请求-响应的主体中检查;我添加了actUpdateClIndivNote.cfm代码。查利特夫;我知道代码是有效的。我在浏览器中运行它,在url中传递参数,它更新正确,没有错误。是的,如果在url中传递参数,它会起作用,因为您直接在url范围中引用它们。您的AJAX请求使用了一个post,因此它们位于表单范围内。我将url更改为表单(很好,我应该看到这个)。但我还是得到了500的误差。未命中错误例程。也不是成功的惯例。我把url改成了表单(很好,我应该看到那个)。但我还是得到了500的误差。未命中错误例程。也不是成功的例行公事,就是这样。有时候我们会陷入困境,我们看不见森林,除非遇到adobe的bug,否则开发中没有任何魔力。那些看起来像魔术,就是这样。有时候我们会陷入困境,我们看不见森林,除非遇到adobe的bug,否则开发中没有任何魔力。那些往往表现得像魔术。