user348173
user348173

Reputation: 9288

form submit not work correctly on iPad

I have a form:

  <form id="pay_form"  action='@ConfigurationManager.AppSettings["LogonUrl"]' method="POST">
                <input type="hidden" name="Signed" value="">
                <input type="hidden" name="email" size="50" maxlength="50" value="">
                <input type="hidden" name="Language" value="en">
                <input id="pay_confirm_order" type="button" class="btn btn-large btn-primary pull-right" value="Submit"/>
     </form>

This is js code which handle form submit:

 $(document).on('click', '#pay_confirm_order', function () {
        fillEpayForm();
    });

When user click Sumbit button I make ajax request:

function fillEpayForm() {
        var url = getCultureUrl('/pay/FillEpayForm?' + Math.random());

        $.ajax({
            type: "GET",
            url: url,
            cache: false,
            dataType: "json",
            success: function (data) {
                $('#pay_form').find('input[name="Signed"]').val(data.signedString);
                $('#pay_form').find('input[name="email"]').val(data.email);
                $('#pay_form').submit();
            },
            async: false
        });
    }

The action attribute contains external URL (this is bank service which recieve post requests). When form is submited than opens bank's site. All works fine on the desktop browsers and android. But on iPad3 the address bar is changed but the page not change. How to solve this? This is problem only on iOS6, on 5.1 version all works fine.

Upvotes: 1

Views: 1404

Answers (2)

Rohan Kumar
Rohan Kumar

Reputation: 40639

Try this:

function fillEpayForm() {
    var url = getCultureUrl('/pay/FillEpayForm?' + Math.random());

    $.ajax({
        type: "GET",
        url: url,
        cache: false,
        dataType: "json",
        success: function (data) {
            $('#pay_form').find('input[name="Signed"]').val(data.signedString);
            $('#pay_form').find('input[name="email"]').val(data.email);
            $('#pay_form').submit();
        },
        async: false
    });
    return false;
}
$(document).on('click', '#pay_confirm_order', function () {
    return fillEpayForm();
});

Upvotes: 1

iappwebdev
iappwebdev

Reputation: 5910

I had some serious mproblem with the ipad because it caches hole views. I solved my problem by using

[OutputCache(Location = System.Web.UI.OutputCacheLocation.None, NoStore = true, Duration = 0, VaryByParam = "*")]

as attribute for my base controller, it may help you.

Upvotes: 0

Related Questions