gpt4 book ai didi

jQuery + Coldfusion,isNumeric 未验证

转载 作者:行者123 更新时间:2023-12-01 02:38:11 25 4
gpt4 key购买 nike

这是 jQuery,game_id 和 $(this).val() 都是整数

    /* AJAX call: save to DB input name=#game_id# value=#game_rating */
$.post("game_rating_submit.cfm", {
id: game_id,
rating: $(this).val()
},
function(data) {
alert('data: ' + data);
});

这是发生故障的冷融合部分:

<cfif NOT IsNumeric("form.rating")>
<cfset variables.error = 'Invalid rating value #form.rating#.' >
</cfif>
<cfoutput>#variables.error#</cfoutput>

出于某种原因,form. rating 不是数字?

最佳答案

当引用“form.Rating”时,是字符串“form.Rating”,如果你想要该值尝试...

 <cfif NOT IsNumeric(form.rating)>
<cfset variables.error = 'Invalid rating value #form.rating#.' >
</cfif>
<cfoutput>#variables.error#</cfoutput>

关于jQuery + Coldfusion,isNumeric 未验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2223900/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com