jQuery ajax回调加载内容显示两次

时间:2014-10-17 10:56:21

标签: javascript jquery ajax load

当执行以下ajax调用时," load"函数重新加载更新的内容,但ajax调用之前的内容仍然可见。所以,你看到" pre-ajax内容" &安培; " post-ajax内容"在一页中:

    <script>

            function myUnPause(elm) {
                  var table = $('#realtime').dataTable(); 
                  var extension = $(elm).closest("tr").find('td.extension').text();
          var agent = $(elm).closest("tr").find('td.name').text();
          alert(extension.trim()+ ' will be unpaused and put back in the Queue');

    $.ajax("/cura/pages/realtime/realtime2.php",{
        type: "GET",
        data:   
        {
        action:'agentpause',
        pauselocation: (extension.trim()),
        queue: 'testq',
        paused: 'false'
        },
        success: function(msg){
            $("#myunpause").load('/cura/includes/realtime.inc.php');
        }           
    });

    }       
</script>

显示此内容的php脚本在/cura/pages/realtime/realtime2.php页面中引用为:

<?php include '../../includes/realtime.inc.php'; ?>

这会导致旧内容保留在同一页面上吗?

任何想法如何更改它以便只显示更新内容?

0 个答案:

没有答案