I am reloading the page after inserting a data into the database via ajax, is it possible to update (rebuild) only the table, or the div it is in?
$(document).ready(function(){
$('#cadastrouser').hide();
$('#formcadastro').submit(function(event) {
// process the form
$.ajax({
type : 'POST', // define the type of HTTP verb we want to use (POST for our form)
url : 'cadastro.php', // the url where we want to POST
data : $("#formcadastro").serialize(), // our data object
dataType : 'json', // what type of data do we expect back from the server
encode : true
})
.done(function(data) {
var resdata = data;
if (resdata['sucesso']) {
location.reload();
}else{
alert(resdata['mensagem']);
}
});
event.preventDefault();
});
});