Your message cancels the redirect or vice versa.
I see no reason to redirect in the first place, since you have an order form that does nothing.
So here is how to do it. Firstly, NEVER add code to the submit button, but do it onsubmit, and secondly, return false to stop sending
function redirect() { window.location.replace("login.php"); return false; }
using
<form name="form1" id="form1" method="post" onsubmit="return redirect()"> <input type="submit" class="button4" name="order" id="order" value="Place Order" > </form>
Or unobtrusively:
window.onload=function() { document.getElementById("form1").onsubmit=function() { window.location.replace("login.php"); return false; } }
using
<form id="form1" method="post"> <input type="submit" class="button4" value="Place Order" > </form>
JQuery
$("#form1").on("submit",function(e) { e.preventDefault();
mplungjan
source share