Doubt to save a data and update a div then

-1

Good morning everyone. Just with jQuery and Ajax I can insert a data into the database and then immediately update a div on the page?

Thank you.

    
asked by anonymous 23.03.2017 / 13:50

1 answer

0

You can, whenever you make an ajax request you will have a callback function, which will be executed when the request finishes and returns something, in case ajax would look something like this: $.ajax({ url: 'url.do.serviço', type: POST // metodo http a ser usado na requisição, data: {algo_a_ser_enviado: dado_a_ser_salvo}, success: function(data){ // função de callback } in the callback function you can access the div by means of an id or class: $("#idDaDiv").html("oque colocar no conteúdo da div"); remembering that you use "#" in case you get the element by the id and "." in case of picking up the class. I hope I have been clear.

Tip: Always read the documentation - > link

    
23.03.2017 / 13:56