I am writing the below code to set the cookie only when the form with id=AuditDetails is submitted, however the following code sets the cookie every time the page reloaded. What am I missing?
$(document).ready(function() { //Initial call to the functions.
showdept();
$("#AuditDetails").on("submit", function() {
document.cookie = "active_audit=1;path=/;expires=1;"
});
});