2
可接受的問題。想要即時更改用戶信息,但不起作用:在調試過程中,它顯示POST爲change.php ok,沒有錯誤,沒有成功。我在哪裏錯了?jEditable出現問題
我的代碼(的index.php)
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="js/jquery.jeditable.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$(".dblclick").editable("change.php", {
submitdata : {userid: "<?=$id?>"},
id : 'elementid',
name : 'newvalue',
indicator : "<img src='styles/images/ui-anim_basic_16x16.gif'>",
tooltip : "click to edit",
event : "dblclick",
style : "inherit"
});
});
</script>
...
<div id="fullname" class="dblclick" ><?=$person->fullname?></div>
change.php
<?php
require 'db.php';
$id=$_POST['userid'];
$field=$_POST['elementid'];
$newvalue=$_POST['newvalue'];
if(isset ($id) && isset($field) && isset($newvalue))
{$query = $db->query("UPDATE usr_table SET '$field'='$newvalue' WHERE id = '$id'") or die(mysqli_errno());
}
?>