IOS web application GO keyboard button does not submit Ajax form

I have this iOS app that should submit a form via Ajax, which works for the most part. The only thing that does not work is that the GO button on the keyboard does not respond.

In a desktop browser, everything works for sending (submit button or key input)

Safari iOS works fine (submit button, GO GO button)

But when using it as a web application on iOS, the GO button does not work!

What can cause this behavior? As far as I know, the iOS web app still uses Safari ... :)

<form id="myForm" name="form" action="link-to-script.php" method="post">
<table>
    <tr>
        <td><input id="name" name="name" type="text" size="20" maxlength="25" /></td>
    </tr>
    <tr>
        <td><input id="email" name="email" type="text" size="20" maxlength="50" /></td>
    </tr>
    <tr>
        <td><input type="submit" name="Submit" value="Send" /></td>
    </tr>
</table>

$('#myForm').submit(function(e) {
    e.preventDefault();  // Doesn't matter
    var dataString = $(this).serialize();
    $.ajax({
        type: "POST",
        url: "http://link-to-script.php?",  // Valid link for the use of this form
        cache: false,
        data: dataString,
        success: function() {

        }
    });
});

UPDATE (SOLVED): I deleted again preventDefault(). This was not a bottleneck, but I don't like the unnecessary code. :)

When I added return false;the bottom of mine $('#myForm').submit(function() {, everything worked the way I wanted.

iOS GO, "Enter" "" .

+5
3

, target = "_ blank" Go iOS.

+4

"/":

$("#myForm input").live("keyup", function(evt) {
  if (evt.keyCode === 13) {
    $("#myForm").trigger("submit");
  }
});
+3

Specify the full URL for the action of the form on the form or do not submit via JS. you have two form actions configured for the same form - one in the action form without a full url, and the second in your Ajax view.

Also, why are you disabling the default form action with your JS?

0
source

All Articles