I have an insert function on my page that uses AJAX/PHP to insert data into myMySQL table, When a row of data is added, my row of data is returned and printed out inside...
<div id="bills"></div>
I can then add another row of data, When i do this however it overwrites the contents of #bills, is there a way to add it to the information in there as opposed to overwriting that?
AJAX
function insertBill()
{
$.post('insert_bill.php', $('form').serialize(),
function(data) {***
$("#bills").html(data);
});
}
$('#bills').append(data);
Instead of .html()
use .append()
$("#bills").append(data);
data
can contain html tags and jQuery will do the right thing.
Yes:
$("#bills").append(data);