Skip to content Skip to sidebar Skip to footer

The Form Code Does Not Work In Firefox (submit And Alert)

This code works on all browsers except Firefox (forms sent successfully, the redirect works, the site asks for confirmation alert). But firefox immediately redirecting to the site

Solution 1:

You've to change the type of input submit to button since you're sending the data using ajax request from the code :

<input type="button"id="submitButton" value="ОПЛАТИТЬ"id="sub"/></form>

Or you could use e.preventDefault() or return false to prevent submission like :

$(document).ready(function () {
    $("#submitButton").click(function (e) {
        e.preventDefault();

        $.post($("#payment").attr("action"), $("#payment").serialize(),
          function () {
              alert('Form 1 submitted');
          });

        $.post($("#normal").attr("action"), $("#normal").serialize(),
          function () {
              alert('Form 1 submitted');
          });
    });
});

Hope this helps.

Solution 2:

The submit button inside the form will trigger its action. Try putting it outside the form.

<form id="payment" name="payment" method="post"    action="https://sci.interkassa.com/" enctype="utf-8">
...
<input type="hidden" name="ik_am_t" value="payway" />
</form>

<input type="submit"id="submitButton" value="ОПЛАТИТЬ"id="sub"/>

Post a Comment for "The Form Code Does Not Work In Firefox (submit And Alert)"