1
<form action="form.php">
<input type="text" name="email">
<input type="text" name="pass">
<input type="submit">
</form>
<script src="jquery.js"></script>
<script>
$("form").on("submit",function() {
$.ajax({
url: 'http://somewhere.org/login.php',
type: 'GET',
data: 'Data written to File',
success:function(response){}});
});
</script>

Ok heres the problem, i tried this code on opera it runs the scripts and the form's action, a success.. But on Qwebview it runs only the scripts but not the form, Why is that? I tried commenting out the scripts but the form still doesn't work.

TheTherminator
  • 101
  • 1
  • 2
  • 13

1 Answers1

1

Your form with ajax requires return false;

In $.ajax use error event for get errors.

Example:

$("form").on("submit",function() {
    $.ajax({
        url: 'http://somewhere.org/login.php',
        type: 'GET',
        data: 'Data written to File',
        success:function(response){
            //Something...
        },
        error:function(a, b, c){
            alert([a, b, c]);//Get error
        }
    });
    return false; //Prevent reload page
});
Protomen
  • 9,471
  • 9
  • 57
  • 124