Alright, so I have a basic form on my page:
<form action='' id='formId' method='POST'>
<table>
<tr>
<td>
<input type='text' name='Chat' autocomplete='off'>
</td>
<td>
<input type='submit' name='Go'>
</td>
</tr>
</table>
</form>
and the javascript is:
<script type='text/javascript'>
$( "#formId" ).submit(function( event ) {
event.preventDefault();
<?php
$Chat = mysql_real_escape_string(strip_tags($_POST['Chat']));
$Go = mysql_real_escape_string($_POST['Go']);
if ($Go) {
if ($Chat) {
mysql_query("INSERT INTO `Chat` (`Chat`)
VALUES('$Chat')");
}
}
?>
});
</script>
I just need it to stop from refreshing when someone submits. I've read a few different posts on here with the same problem, but none seemed to work for me.
Returning false will prevent page reloading.