Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.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 jQuery,AJAX不会在DIV中显示容器_Php_Jquery_Html_Ajax - Fatal编程技术网

Php jQuery,AJAX不会在DIV中显示容器

Php jQuery,AJAX不会在DIV中显示容器,php,jquery,html,ajax,Php,Jquery,Html,Ajax,我的网页中有以下jQuery脚本: <script> $(function() { function callAjax(){ $('#lastlogins').load("ur.php"); } setInterval(callAjax, 1000 ); }); </script> $(函数(){ 函数callAjax(){ $('#lastlogins').load(“ur.php”); } setInterval(callA

我的网页中有以下jQuery脚本:

<script>
$(function() {
    function callAjax(){
        $('#lastlogins').load("ur.php");
    }
    setInterval(callAjax, 1000 );
});
</script>

$(函数(){
函数callAjax(){
$('#lastlogins').load(“ur.php”);
}
setInterval(callAjax,1000);
});
但是,在容器lastlogins中,没有显示文件ur.php,它只是空的。我创建了如下div:

<div id="lastlogins">
</div>

快速查看
.load
功能后,只有一种可能。。。您的PHP文件没有返回任何有用的内容。直接在浏览器中运行它,并确保它返回有效的HTML


您的jQuery函数是正确的。

我看不出您的代码有任何错误。唯一的问题是您的
ur.php
文件。只要试着直接访问你的文件,看看是否有效

同时,请参考我的示例代码

<script>
$(function() {
    function callAjax(){
        $('#lastlogins').load("/SivaCharan/EGxWL/show");
    }
    setInterval(callAjax, 1000 );
});
</script>
<div id="lastlogins">
</div>

$(函数(){
函数callAjax(){
$(“#lastlogins”).load(“/SivaCharan/EGxWL/show”);
}
setInterval(callAjax,1000);
});

请参阅我的

您是否在控制台上看到任何错误?是的,这是我的ur.php文件中的问题。无论如何,谢谢你:)