jquery 对用户预测表中的行与结果表中的结果进行比较。如果值相同,我想奖励用户 3 分并添加到总分中。
$('#pred_table tr').each(function(){
var currentRowHTML=$(this['Home_Score']&&this['Away_Score']).html();
$('#fixure tr').each(function(){
if($(this['Home_Score']&&this['Away_Score']).html()===currentRowHTML){
//not sure where to begin with the doCalculation function
$(this).doCalculation("award 3 points into total points in another
table in database");
}
});
});
最佳答案
将其添加到您的文件中:
<input type="hidden" id="processURL" value="PROCESS.PHP">
输入此代码:
var url = $('#processURL').val();
var add_this = 3;
var postit = $.post( url, {add_this:add_this});
postit.done(function( data ) {
alert('Three Point Added');
});
这是哪里
//not sure where to begin with the doCalculation function
$(this).doCalculation("award 3 points into total points in another
table in database");
通过 PROCESS.PHP
添加到数据库
如果替换 'Three Point Added'
在警报中显示 data
不管你 echo
上PROCESS.PHP
将在警报中呈现。
关于php - 创建一个jquery函数,根据比较将分数添加到MySQL表中的total-points列中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31102689/