Good evening guys I'm doing a search with jQuery and the keyup () event like this:
$('#colaborador').keyup(function(){
var txtInput = $('#colaborador').val();
if(txtInput.length == 0){
$('#listPhone').html('');
return;
}
var html = '';
$.ajax({
url : "paginas/listPhone.php",
type : "GET",
data : {busca: txtInput},
dataType : "json",
success : function(data){
var html = "";
for (var i = 0; i < data.length; i++) {
html += '<tr>';
html += ...
html += '</tr>';
}
$("#listPhone").html(html);
}
});
});
So far everything goes well, with each typed letter my script goes into the database and returns a JSON with the lines of the searched content, no problem.
After the return I open a modal with a form inside, also without problems!
To save the edit I make in this form I use the following code:
$('#salvar').click(function() {
var dados = $('#myForm01').serialize();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'paginas/editarRamal.php',
async: true,
data: dados,
success: function(response) {
location.reload(); //DÚVIDA AQUI
}
});
return false;
});
I am doing a reload of the page, but I would like to know how I would do to when clicking the record button go back to the displayed list only with the new value in the edited field.