php - Appending a div and article tag using jQuery or AJAX -


so code, , want append <article> tag data database display username , post, next entry should in next line.

<div id ="test">   <article id="main">     <p><div id ="post"><?php //echo $row ['post']; ?></p></div>       <p><?php $p= $row['post']; ?></p>      <a href="http://www2.cs.uregina.ca/~khanna2g/public_html1/hashtagresult.php?hs=<?php echo $row['hashtag']; ?>">      <?php      $hh=$row['hashtag'];      if(strlen($hh)>14){        echo "#".$hh;      }      else{        echo "";      }      ?>      </a>      <?php       $sqlw = "select * a4_comment post ='$p'";      $result = mysqli_query($conn, $sqlw);      while ($row = mysqli_fetch_assoc($result)) {?>      <article class = "comment">      <?php        echo $row['email']." :- ";        echo $row ['comment'];      ?>      <br/><br/>      </article>      <?php }?>   </article> </div> 

this whole jquery:

$(document).ready(function(){         setinterval(d,6000);           });           function d(){             $.ajax({             url: 'homeajax.php',             type: 'get',             datatype: 'json',             success: function(data){                 console.log(data[0].pt);                  var post=document.getelementbyid("post");                 var main=document.getelementbyid("main");                 var test=document.getelementbyid("test2");                 var i=0;                for(i=data.length-1;i>0;i--){                      var r=document.createtextnode(data[i].pt);                     main.appendchild(r);                        //test.appendchild(main);                     }                                }             });           } 

i showing posts because messy, not show next post in line or in <article> tag.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -