Mysql
 sql >> Database >  >> RDS >> Mysql

Ricarica i dati MySQL all'interno di un DIV usando Ajax

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>