You are not cancelling the submit action.
<input type="submit" value="Start" onclick="startFunction()"/>
<input type="submit" value="Stop" onclick="stopFunction()"/>
you need to return false or call preventDefault
<input type="submit" value="Start" onclick="startFunction(); return false;"/>
<input type="submit" value="Stop" onclick="stopFunction(); return false;"/>
You really should not be using inline events, You are using jQuery, utilize it!
$(window).on("click", "input[type=submit]", function(e) {
e.preventDefault();
if (this.value==="Start") {
startFunction();
} else {
stopFunction();
}
});
And for your setTimeout, you really should not pass in a string since that has to be evaluated every time it is called, pass in a function that is either named or anonymous.