I want to add load spinner when click on Add And remain visible until the completion of POST then get alert Item has been added successfully.
$('#add').click(function() {
fetch("url")
.then(response => response.json())
.then(result => setTimeout(function(){
location.reload(alert("Item has been added successfully"));
},1250))
.catch(error => console.log('error', error));
});