setInterval函数不工作的PHP文件 [英] SetInterval function is not working with PHP File
本文介绍了setInterval函数不工作的PHP文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的index.html喜欢这个
I have index.html like this
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var auto_refresh = setInterval(
function ()
{
//alert("abc");
$('#mydiv').load('xyz.php').fadeIn("slow");
}, 1000);
});
</script>
</head>
<body>
<div id="mydiv"> </div>
</body>
</html>
在同一文件夹中有xyz.php文件,其code是这样的:
In same folder there is xyz.php file whose code is this:
<?php
echo "My first PHP script!";
?>
当我取消 //警报(ABC);
和评论 $('#mydiv)的负载('xyz.php ').fadeIn(慢);
警报消息来自每一秒,但是当我调用PHP文件和评论警报消息反之亦然无法正常工作。为什么呢?
When I uncomment //alert("abc");
and comment $('#mydiv').load('xyz.php').fadeIn("slow");
alert message comes every second but vice versa is not working when I am calling php file and commenting alert message. Why?
推荐答案
我改名index.html来的index.php,并呼吁通过本地主机/ firstproject / index.php文件
。这工作
I renamed index.html to index.php and called that by localhost/firstproject/index.php
. That worked
这篇关于setInterval函数不工作的PHP文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文