Gavin5511
Gavin5511

Reputation: 791

Jquery HTML show then hide

i currently have the following AJAX response, which displays some HTML retrieved from the target page:

success: function (data, textStatus, jqXHR) {
$("#RoomAddResponse").html(data);
$("#RoomAdd")[0].reset();

How do i change it so that the HTML data shows for 5 seconds, then hides again?

Upvotes: 1

Views: 48

Answers (1)

George
George

Reputation: 36784

Set a timeout with a function that will empty #RoomAddResponse

success: function (data, textStatus, jqXHR) {
    $("#RoomAddResponse").html(data);
    setTimeout(function(){
        $("#RoomAddResponse").empty();
    }, 5000);
    $("#RoomAdd")[0].reset();
}

Upvotes: 4

Related Questions