使用jsGrid更新项

update items using jsGrid

本文关键字:更新 jsGrid 使用      更新时间:2023-09-26

我想使用jsGrid库到我的网站web,你能帮助我吗?我将非常感激。我如何将更新的项目发送到php代码update.php?这是我尝试过的,但对我不起作用。我得到白细胞:

  updateItem: function(item) { 
     var d = $.Deferred();
       $.ajax({
                type: "GET",
                url: "update.php",
                data:{name:item.name}
            }).done(function(response) {
                d.resolve(response);
            }).fail(function() {
                d.resolve(previousItem);
            });
            return d.promise();
    }

update.php:

<?php
include("connexion.php");
$sql = "UPDATE servers SET name = '".$_GET['name']."' WHERE id = 1";
if( $result = pg_query($sql))    
{  
echo 'Data Updated';  
}
?>

检出php + jsgrid https://github.com/tabalinas/jsgrid-php的样例项目。它展示了如何在前端和后端正确地实现更新。