2016-09-13 01:05
浏览 29


So currently I am creating approve or deny page for several users in PHP and the page that I am building needs to be REFRESH

1.What I am trying to do is refreshing a SPECIFIC DIV

     The function refresh in javascript is working but there is
     a sudden duplication of div. 

I checked it several times and there is NO double(2) input="type" for search.

What line should I modify in to remove the duplicate SEARCH in div ref1 ?

  1. Can you guys please suggest an alternative way to refresh a div ?

enter image description here

               background-color: darkseagreen;
           } #ref1{
               background-color: pink;
        <div id="ref1">
               shortcut preview **
              PHP -> isset ....add, delete, approve, search                       
               then view the content (SELECT * FROM dbname)  
               see image ^

   <div id="ref2">
            <form action="tor.php" method="post">
              <input type="text" name="search" placeholder="Search for members.." onkeydown="searchq();" required  />
              <input type="submit" value=">>">
              <?php echo("$output"); ?>

<script langauge="javascript">
    function updateContent() {
    $.get("#", function(data) 
        $("#ref1").html( data ); 
        setInterval(updateContent, 1000);

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dongmi1864 2016-09-13 01:48

    you need to get the content of the ref1 div only to replace the previous content with, as you now get the entire HTML page and replace the div content with it.

    function updateContent() {
       $.get("#", function(data) 
        var x = document.createElement("div"); 
            x.innerHTML = data;
           $("#ref1").html( $(x).find("#ref1").html()); 
        setInterval(updateContent, 1000);
    打赏 评论
  • dongyulian5801 2018-07-05 03:34

    Message to myself is to use AJAX or better create an API.

    打赏 评论

相关推荐 更多相似问题