Ok i'm trying to build a forum with jquery ajax characteristics. Below is the html/jquery coding. And i know jquery is loaded because I did the alert(1);
inside the document ready and it worked.
<!doctype>
<html>
<head>
<title>Shouts!</title>
<script src="jquery.js"></script>
<script>
$(document).ready(function() {
$("#messages").load(function('loadchat.php');
$("#post").submit(function(){
return false;
});
});
</script>
</head>
<body>
<div id="messages"></div>
<table width="480" BACKGROUND="images/commentback.jpg">
<tr>
<td>
<form id="post" method="post" action="datetest.php">
<span class="whitetitle">Name:<br><input name="messages" type="text" STYLE="background: white; border: 1px #000000 solid;"><br >
<input type="submit" value="send">
</form>
</td>
</tr>
</table>
</div>
<br><br>
</body>
</html>
Below is the php load I'm using to load my database info. I've ran this without jquery and it works fine but I want it to load in messages id. Do I have to so something different when i integrate php and jquery that I'm not aware of?
<?php
include 'config2.php';
$dbname = 'test';
$tablename = 'time';
include 'opendb.php';
$res = mysql_query("SELECT timestamp, message FROM time ORDER BY timestamp DESC LIMIT 0,10;");
while ( $row = mysql_fetch_array($res) ) {
echo $row["message"] . "<br />";
echo $row["timestamp"] . "<br />";
echo date("g:i a F j, Y ", $row["timestamp"] ) . "<br /><br />";
}
?>