Good afternoon, friends! I'm skating and do not leave the place, the structure of the code is as follows:
insert.php
$.ajax({
type: 'POST',
url: 'action.anuncio.php',
data: dados,
dataType: 'json',
success: function(response) {
location.reload();
}
});
action.anuncio.php
include_once 'class.anuncio.php';
$anuncio = new Anuncio();
switch ($_POST[]) {
case 1:
$anuncio->inserir('informações');
break;
}
class.anuncio.php
include_once 'conexao.php';
public Anuncio() {
function listarAnuncios() {}
function inserir(){
/*instruçoes sql para gravação*/
if($result) {
$response = array('sucess'=>sucess);
encode_json($response);
}
}
}
The code writes and deletes only that it does not refresh the page, I need to press F5 to update, it seems that the ajax trigger is not getting the correct response to reload.