Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/411.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
Javascript 如何使用ajax每15秒只刷新一个div_Javascript_Php_Html_Ajax - Fatal编程技术网

Javascript 如何使用ajax每15秒只刷新一个div

Javascript 如何使用ajax每15秒只刷新一个div,javascript,php,html,ajax,Javascript,Php,Html,Ajax,我希望这个div每15秒刷新一次,它已经刷新了,问题是它刷新了一次,下次刷新表时它被删除了,我不知道为什么:( 身份证件 名义 阿佩利多斯 电传 地位 这是ajax,其中附加了json var auto_refresh = setInterval( function () { $('.refresh').load('index.html'); }, 10000); // refresh every 10000 milli

我希望这个div每15秒刷新一次,它已经刷新了,问题是它刷新了一次,下次刷新表时它被删除了,我不知道为什么:(


身份证件
名义
阿佩利多斯
电传
地位
这是ajax,其中附加了json

    var auto_refresh = setInterval(
        function ()
        {
        $('.refresh').load('index.html');
        }, 10000); // refresh every 10000 milliseconds


   $(document).ready(function() 
{ 

    $.ajax({
        type: "GET",
        url: "editinplace.php?tabla=1"
    })
    //Vector
    .done(function(json)  
    {
        json = $.parseJSON(json)
        for(var i=0;i<json.length;i++)
        {   
            $('.editinplace').append
            (
                "<tr><td class='id'>"
                +json[i].id
                +"</td><td>"
                +json[i].nombre
                +"</td><td>"
                +json[i].apellidos
                +"</td><td>"
                +json[i].telefono
                +"</span></td><td class='editable' data-campo='status'><span>"
                +json[i].status
                +"</span></td></tr>");
        }

    });
var auto_refresh=setInterval(
函数()
{
$('.refresh').load('index.html');
},10000);//每10000毫秒刷新一次
$(文档).ready(函数()
{ 
$.ajax({
键入:“获取”,
url:“editinplace.php?tabla=1”
})
//载体
.done(函数(json)
{
json=$.parseJSON(json)
对于(var i=0;i此处
refresh\u div()
15秒调用一次函数

function refresh_div()
{
   // Your ajax code here
}
setInterval('refresh_div()', 15000);

URL将是php文件的名称。您还可以指定DIV的名称和您尝试过的代码?
function refresh_div()
{
   // Your ajax code here
}
setInterval('refresh_div()', 15000);
$(document).ready(function(){
setInterval(function(){

$('div').ajax({

url: "test.php",

}).done(function() {

$(this).html( "done" );

});

}, 15000); // 15000 micro second = 15 sec.

});