this is simple subscriber form submit with jQuery Ajax, everything is working fine but alert response show only one time until page refresh.
Please Help me how to fix it.
Here is my view code
$(document).ready(function () {
$(“#ssubmit”).click(function (e) {
e.preventDefault();
let subscriber = $("#subscriber").val()
subscriberdata = {subscriber: subscriber,}
$.ajax({
type: "POST",
url: "form-process.php",
data: JSON.stringify(subscriberdata),
success: function (response) {
subscribersucess = "<div class='alert alert-success text-center mt-3'>" + response + "</div>";
$("#alerts").html(subscribersucess);
setTimeout(function(){
$('#alerts').fadeOut("slow");
},5000)
$("#subscriberform")[0].reset();
}
});
})
});