【发布时间】:2012-04-12 21:35:24
【问题描述】:
我正在使用$.post() 向我的cfc 发送一个json,它会更新一些记录。我没有将 json 返回到调用页面,我只是返回我在 cfc 中设置的变量的内容。根据该变量的值,更新成功/失败。我似乎无法了解变量的内容。我刚开始使用 jQuery,所以我认为我做得对,但显然不是。
jQuery:
$("#edit_button").click(function(){
if(theArray.length > 0){
theJson = JSON.stingify(theArray);
$.post("cfcs/fund_profile.cfc",{
method:"updateProfile",
data:theJson,
dataType:"text"
success:function(response){alert(response);}
});
}
});
我不会发布整个 cfc,只发布重要部分。
我只是返回一个字符串。
<cffunction name="updateProfile" ...>
...
<cfif message neq ''>
<cfreturn message>
<cfelse>
<cfset message = "success">
</cfif>
<cfreturn message>
</cffunction>
【问题讨论】:
-
仅供参考,您不是将 JSON 发送到 cfc,而是发送一个字符串。
标签: jquery coldfusion cfc