Sorry bad title. I've got a simple form with an input field and I know that every time I submit the form the number of arguments that gets passed is one. When the argument of one gets passed reload gets evaluated to true and if reload is true the page get's refreshed. The problem is that what if I don't want to refresh the page. What if I want reload to get evaluated to false in certain instances. Is there some parameter I can pass into the userInput function that would evaluate certain scenarios to false? Any ideas? I learn best by code samples, please include where applicable. I also have a fiddle going here:
<form id="myForm">
<input id="address" name="address" value="address">
<input type="submit" name="submit" value="submit">
</form>
function userInput(userLocation, input){
$('#myForm').on('submit', function(e){
reload = arguments.length > 1 ? arguments[1] : true;
if (reload) location.reload();
console.log(reload);
});
}
$(document).ready(function () {
userInput();
});