我使用ajax/json通过php从mysql服务器获取随机行。然后,我从随机行获得的不同数据被存储在vars中。
$.ajax({
url: 'api.php',
data: "",
dataType: 'json',
success: function(data)
{
var id = data[0];
.....然后,我想使用字段ID作为标识符,使用update.php更新mysql数据库中特定行中的字段。
$sql = "UPDATE table SET field1 = field1 +1 WHERE id = '???'";现在,我刚开始使用jquery-post,所以有人能帮助我传递数据(ID号)并在update.php中正确使用它吗?
<script>
$(document).jkey('a',function() {
$.post("update.php");
$('.id').html(data);
});
</script>发布于 2011-10-14 21:32:47
$.post("test.php",{姓名:"John",时间:“2 2pm”} );
正如您在示例中看到的那样
http://api.jquery.com/jQuery.post/
https://stackoverflow.com/questions/7768347
复制相似问题