私はjqueryが初めてで、ダイアログボックスでデータベースを呼び出して更新する関数を作成しようとしています。以下のコードを生成するために既存のテンプレートを変更しましたが、関数 savefee を jquery 関数によって呼び出すことができません。JavaScript コンソールにエラーはありません。どんな助けでも大歓迎です。
`
<cfset getfees = new artservice().getfees()>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
<script>
$(document).ready(function() {
$(".artdiv").click(function() {
var initialDiv = this;
//based on which we click, get the current values
var feeid = $(this).data("fee_id");
var feetitle = $("h2", this).text();
// set form values
$("#fee_id").val(feeid);
$("#fee_title").val(feetitle);
$("#editForm").dialog({
buttons: {
"Save": function() {
var thisDialog = $(this);
$.post("artservice.cfc", {
method: 'savefee',
fee_id: $("#fee_id").val(),
fee_title: $("#fee_title").val()
},
function() {
//update the initial div
$("h2", initialDiv).text($("#fee_title").val());
$(thisDialog).dialog("close");
});
}
}
});
});
});
</script>
<style>
.artdiv {
padding: 5px;
margin: 5px;
background-color: #80ff80;
}
#editForm {
display:none;
}
</style>
</head>
<body>
<cfoutput query="getfees">
<div class="artdiv" data-fee_id="#fee_id#">
<h2>#fee_title#</h2>
</div>
</cfoutput>
<div id="editForm" title="Edit Art">
<input type="hidden" id="fee_id">
<p>
<b>Name:</b><br/>
<input type="text" id="fee_title">
</p>
</div>
</body>
</html>
`
Cfcは以下です
`
<cffunction name="getfees" access="public">
<cfquery datasource="dsn" name="getfees" maxrows="10">select fee_id, fee_title from table</cfquery>
<cfreturn getfees>
</cffunction>
<cffunction name="savefee" access="public">
<cfargument name="fee_id" required="yes">
<cfargument name="fee_title" required="yes">
<cfquery datasource="dsn">update table set fee_title = '#arguments.fee_title#' where fee_id = #fee_id#</cfquery>
</cffunction>
`
application.cfc のこの関数でエラーが発生しました「onCFCRequest 関数に渡された ARGS 引数は文字列型ではありません」
public void function onCFCRequest(required string cfcname, required string method, required string args) {
return;
}