I'm trying to post data to my table using AJAX, I have the following form,
<form>
Total <input type="text" id="total" name="total" /><br />
Bill name<input type="text" id="bill-name" name="bill-name" /><br />
bill descriptiion <input type="text" id="bill-description" name="bill-description" /><br />
bill colour<input type="text" id="bill-colour" name="bill-colour" />
<input type="button" value="submit" onClick="insertBill();" />
</form>
And my AJAX code is as...
<script type="text/javascript">
function insertBill()
{
var bill = $("#bill").val();
$.post('insert_bill.php', {total: total, bill-name: bill-name, bill-description: bill-description, bill-colour: bill-colour}, function(data)
{
$("#bills").html(data);
});
}
</script>
For some reason however my values aren't being passed. I'm new to AJAX and so I've been following a tutorial so excuse my naivety! How do I make this work?
bill. Edit your form tag, and add this id