簡體   English   中英

jQuery / JavaScript無法正確加載div?

[英]JQuery/Javascript not properly loading a div?

PHP 7.0版

jQuery版本3.1.0

您可以看到,代碼上方的所有內容都只是每五秒鍾復制並粘貼一次,而不是刷新。

目的是每五秒鍾刷新一次include。

網站: 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>

這是加載功能的正常行為。

您應該嘗試:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM