JQuery / Javascript没有正确加载div?

时间:2016-07-25 01:13:12

标签: javascript php jquery html

PHP 7.0版

JQuery版本3.1.0

您可以看到代码上方的所有内容都是每五秒复制和粘贴一次,而不是刷新。

目的是每隔五秒刷新一次包含。

网站:http://ssmsportal.cf/pages/incomingCalls.php

代码:

<!doctype html>
<html><head>
        <meta charset="utf-8">
        <title>ServerSide Moderation Services</title>
        <link rel="stylesheet" href="../styles/tablesStyles.css" type="text/css" />
        <link rel="stylesheet" href="../styles/incomingCallsStyle.css" type="text/css" />
        <script src="//ajax.googleapis.com/ajax/libs/dojo/1.11.2/dojo/dojo.js"></script>
        <script src="../scripts/general.js" type="text/javascript"></script>
        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>


    <title>Whats Up?</title>

    </head>
    <body class="body">
        <?php include '../includes/header.php'; ?>
        <div class="mainContent">
            <div class="logRegArea">
                <article class="callsContent" style='padding-left: 0px; padding-right: 0px;'>
                    <header>
                        <h2 class="loginArea" style="text-align:center">Incoming Calls:</h2>
                    </header>
                    <content>
                        <div id="login">
                        <?php include '../includes/incomingCalls.php'; ?>
                        </div>
                        <script src="../scripts/jquery.js" type="text/javascript"></script>
                        <script type="text/javascript">
                            $(document).ready(function() {
                                setInterval(function () {
                                    $('#login').load('../includes/incomingCalls.php')
                                }, 5000);
                            });
                        </script>
                    </content>
                </article>
            </div>
        </div>
        <footer class="mainFooter">
            <p>This website was developed by ROBLOX user: <a href="https://www.roblox.com/users/8869935/profile" title="Made by: wattleman">wattleman</a></p>
        </footer>
    </body>
</html>

1 个答案:

答案 0 :(得分:1)

这是加载函数的正常行为。

你应该尝试:

$.get("../includes/incomingCalls.php", function(data) {
     $("#login").html(data);
});