I am trying to make my form update without having to refresh it but the data is not being sent to the database. Can you find anything wrong with the jquery?
Jquery
<script type="text/javascript" src="../includes/jquery-1.8.2.min"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#save').click(function(){
var site_name = $("#site_name").val();
var display_notice = $("#display_notice").val();
var notice = $("#notice").val();
$.ajax({
type: "POST",
url: "submit_configuration.php",
data: "site_name=" + $('#site_name').val() + "&display_notice=" + $('#display_notice').val() + "¬ice=" + $('#notice').val(),
cache: false,
});
});
});
</script>
submit_configuration.php
<?php
include('../includes/mysql.php');
$site_name = $_POST['site_name'];
$display_notice = $_POST['display_notice'];
$notice = $_POST['notice'];
mysql_query("UPDATE configuration SET site_name = '$site_name', display_notice = '$display_notice', notice = '$notice'");
?>
my form
<form id="configuration" name="configuration" method="POST" action="" class="form" />
<table class="data1">
<tr>
<td width="50%">
<p style="line-height:20px;"><strong>Site Name</strong></p>
<p style="line-height:20px;">The name of the site displayed on the title bar of each page.</p>
</td>
<td width="50%"><input type="text" id="site_name" name="site_name" maxlength="100" style="width:400px" value="<?php echo $row_configuration['site_name']; ?>" /></td>
</tr>
<tr>
<td width="50%">
<p style="line-height:20px;"><strong>Display Notice</strong></p>
<p style="line-height:20px;">Show a notice at the top of each page.</p>
</td>
<td width="50%"><input type="checkbox" id="display_notice" name="display_notice" value="1" <?php if ($row_configuration['display_notice'] == 1) { echo "checked";} ?> style="border:0"/></td>
</tr>
<tr>
<td width="50%">
<p style="line-height:20px;"><strong>Notice Text</strong></p>
<p style="line-height:20px;">The text to show when the Display Notice option is checked.</p>
</td>
<td width="50%"><input type="text" id="notice" name="notice" maxlength="100" style="width:400px" value="<?php echo $row_configuration['notice']; ?>" /></td>
</tr>
</table>
<br />
<p align="center"><input type="submit" id="save" name="save" value="Save Changes" class="submit" /></p>
</form>