php - 创建一个jquery函数,根据比较将分数添加到MySQL表中的total-points列中

标签 php jquery mysql ajax

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不管你 echoPROCESS.PHP将在警报中呈现。

关于php - 创建一个jquery函数,根据比较将分数添加到MySQL表中的total-points列中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31102689/

相关文章:

jquery - 如何使用Phonegap和JqueryMobile上传文件?

javascript - 如何使用 JavaScript 删除特定的 CSS 样式?

php - 如何用 Eloquent (Laravel) 调用存储过程?

mysql - 如何在列中创建具有相同值的 1000 行?

php - 太多的 mySql 事件

php - 强制 Laravel 忽略异常

jQuery 缺少 JSON.stringify

MySQL 通过优化选择不同或组

java - 我应该将 mysql 数据加载到数组中还是只是使用 java 查询数据库

php - Pimcore - 如何通过自定义插件创建自定义表?