I know this subject has been beaten to death. But I'm not able to resolve it from my research. I'm using CF 9 and Jquery 1.8. I tried to use a cfc for the ajax call and got the 500 error. I changed it to a cfm and have turned the url path inside out. I have a lot of other code that doesn't provide a path (default to the current folder). Dev tools gives me the following response;
<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>
I can post the page directly from the browser and it executes perfectly. No 500 error and the data is updated to the DB. There are no log entries that I can find on the server. The code snippet is;
$('##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();
}
});
});
actUpdateClIndivNote.cfm code;
<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>
Do you need
'&IndivNote' + thisindivnote
'&IndivNote=' + thisindivnote
Of note, I would <cfparam>
your expected values to set defaults for debugging. Then you can take them away to see issues. You can also add dumps to dump the URL/Form scope and then just check those in the replay of your XHR request in Chrome dev tools.