Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/252.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Ajax调用未第一次更新_Php_Ajax_Call - Fatal编程技术网

Php Ajax调用未第一次更新

Php Ajax调用未第一次更新,php,ajax,call,Php,Ajax,Call,我使用Ajax调用来显示数据和更新数据。Ajax调用运行良好,但不能一次性更新。服务器端数据库更新良好。对于UI部分,它没有更新 使用Ajax调用 $('#loginbutt').click(function(){ $.post('data.php',{action: "update"},function(res){ $('#result').html(res); }); var servertime = $("#timer1").

我使用Ajax调用来显示数据和更新数据。Ajax调用运行良好,但不能一次性更新。服务器端数据库更新良好。对于UI部分,它没有更新

使用Ajax调用

    $('#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);  
                               }
                      });

        });
它正在更新data.php,但没有更新inset_time.php。数据正在插入到服务器中。但用户界面没有更新。在data.php中,我给出了插入数据的插入查询。在inset_time.php中,我给出了用于显示数据的select查询。但为什么不是在我点击loginbutt的时候。试试这个

$(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);  
                           }
                  });

    });

});

请添加您的html代码,以便我可以帮助您。什么是
dataString
。?@Dipesh Parmar请立即检查。我已经更新了我的代码我已经使用了文档。准备好了,但我没有保留在这里。。在dat中,只有我保留了这个功能