私はかなり単純に見える何かを行う方法を見つけようとしていますが、解決策を見つけることができないようです。HTML を使用して作成された投稿があり、その一部を動的に変更したいと考えています。サーバー側、AJAX、および jQuery UI 1.10.1 & jQuery 1.9.1 に Coldfusion 9 を使用しています。
私がやりたいことは、AJAX に投稿し、cfc 内のデータ サーバー側を置き換えることです。クライアント側にあるコードは次のとおりです。
var ipost = '<li> <h2><a href="PersonsID" target="_blank">Persons Name</a></h2> </li>';
var message_a = $('#message_a').attr('value');
$.ajax({
type: "POST",
url: "cfc/cfc_Forum.cfc?method=func_AddNew&returnformat=json",
data: { message:"message_a=" + wall_post },
success: function () {
$('ul#posts').prepend(ipost);
}
});
「PersonsID」を「Session.Variable1」に、「Persons Name」を「Session.Variable2」に置き換えたいと思います。cfc は CF の標準プロトコルです。コンポーネントは次のようになります。
<cfcomponent>
<cffunction name="func_AddNew" access="remote" returntype="struct">
<cfargument name="message" type="string" required="true" />
<--- ********** replace "Persons ID" and "Persons Name" ************** --->
<!--- ********* INSERT INTO DATA BASE ************ --->
<cfreturn return />
</cffunction>
</cfcomponent>
どんな推奨事項も素晴らしいでしょう!