Send a message after using the load () function

0

I am using the function load() to bring a table of information. In this table I have a button in each row to edit the information corresponding to this, when clicking on the button "edit" sent by AJAX the id of the corresponding information to edit and charge this information inside a "MODAL" (so far we go well).

Where my inconvenience comes is once the new information is sent; If there is some kind of error, it shows it to me in my "MODAL", but when I update the information I close the modal and charge the information table again so that the information appears updated, but I am trying to send a message when the page is updated.

$(this).modal('hide');
$('body').removeClass('modal-open');
$('.modal-backdrop').remove();

$("#tableInsurance").load('aseguradora/tableInsurance.php');            
$('.msg').html("<div class='alert alert-success fade in'><a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a><span id='message'></span></div>");
$('#message').append(data.msg);

I close the modal that I opened to insert the information, once it closes I charge the table again and "sent the message", the message never arrives ... I have given mind and I do not arrive at a solution.

echo json_encode(array(
    'status' => 2,
    'msg' => "Se ha actualizado con éxito."
));

This is sent from where the information is updated .. it works perfectly if I load it into the "modal".

    
asked by Jorge D. Jesus 26.08.2016 в 22:06
source

1 answer

0

I'm not sure about the doubt, but the method load() accepts a callback :

$("#tableInsurance").load('aseguradora/tableInsurance.php', function() {
  // tableInsurance.php ha cargado
})
    
answered by 29.08.2016 в 11:07