我使用Ajax调用显示数据和更新数据。Ajax调用运行良好,但它不会一次更新。服务器中的数据库更新良好。对于UI部分,它不会更新。
使用过的阿贾克斯调用
$('#loginbutt').click(function(){
$.post('data.php',{action: "update"},function(res){
$('#result').html(res);
});
var servertime = $("#timer1").text();
var dataString = 'current_time='+ servertime;
$.ajax({
type: "POST",
url: "inset_intime.php",
data:dataString ,
cache: true,
beforeSend: function(html) {
document.getElementById("lastfive").innerHTML = '';
},
success: function(html){
$("#lastfive").append(html);
}
});
});
它正在更新数据.php但不更新inset_time.php数据正在很好地插入 inti 服务器。 但 UI 未更新。在数据中.php我给出了插入数据的插入查询。inset_time.php我给出了用于显示数据的选择查询。但是为什么不是在我点击登录屁股的时候。
试试这个
$(document).ready(function(){
$('#loginbutt').live('click',function(){
$.post('data.php',{action: "update"},function(res){
$('#result').html(res);
});
var servertime = $("#timer1").text();
var dataString = 'current_time='+ servertime;
$.ajax({
type: "POST",
url: "inset_intime.php",
data:dataString ,
cache: true,
beforeSend: function(html) {
document.getElementById("lastfive").innerHTML = '';
},
success: function(html){
$("#lastfive").append(html);
}
});
});
});