Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Laden Sie MySQL-Daten in einem DIV mit Ajax neu

in post.php :

$sql = mysql_query("SELECT * FROM posts WHERE active ='0' LIMIT 1") or die (mysql_error());
$row = mysql_fetch_array($sql);
echo $row['sitepost'];

JS :

<script type="text/javascript">
$(document).ready(function(){
   $("#yes").click(function(){
      $(".post-body").eq(0).load("post.php");
   })
})
</script>

HTML :

<div id="yes">YES</div>
<div class="post-body"></div>