How to add close window to the HTML script on clicking on Save button
$("#SaveBtn").click(async function(event) { $('#ExtensibilityModalWindowViewModel').hide(); event.preventDefault(); $('#processing').show(); // Show the processing GIF var oooFlagValue = $('#out-of-office-flag').is(':checked'); var startDate = $('#start-date').val(); var endDate = $('#end-date').val(); var oooMessage = $('#out-of-office-message').val(); // Convert dates to ISO 8601 format var startDateTime = startDate ? new Date(startDate).toISOString() : null; var endDateTime = endDate ? new Date(endDate).toISOString() : null;
console.log("Button Clicked! Out of Office Flag: " + oooFlagValue); $('#ExtensibilityModalWindowViewModel').hide();
// Set a timeout to close the window after 5 seconds var closeModalTimeout = setTimeout(function() { //window.close(); console.log(this); }, 5000);
/* await updateAccount(restUrl, sessionID, acctID, oooFlagValue, startDateTime, endDateTime, oooMessage).done(function(response) { console.log("Account update call succeeded"); console.log(response); clearTimeout(closeModalTimeout); // Clear the timeout if the request completes in time window.close(); // Close the window immediately }).fail(function(xhr, status, error) { console.error("Error occurred: " + status