Question: jQuery AJAX seems to be sending two requests. As I'm using a two-factor authentication method, based on time, the second request is failing hence the original request is "failing".

The first is a post request, that's fine, but then there's a GET request, which isn't fine. 

Here's the javascript I'm using to generate the query.

```
$('#form').live('submit', function(event) {
    var target = $('#ajax');
    var url = '/ajax/user/authenticateLevel3';
    $.ajax({
        type: "POST",
        url: url,
        data: $('#form').serialize(),
        dataType: 'json',
        success: function(data, status) {
            $.getJSON(url, function(data) {

                if (!data.resultCode) {
                $('#ajax').html($.base64.decode(data.html));
                $('#ajax').modal();
                } else {
                    location.reload();
                }

            });
        }
    });
    event.preventDefault();
});

```

Any ideas how I can work around this?

Answer: 
That is because you are doing 2 ajax calls (`.ajax` and `.getJSON`)

Try doing this instead (using document event delegation instead of `.live`):

```
$(document).on('submit', '#form', function(event) {
    var target = $('#ajax');
    var url = '/ajax/user/authenticateLevel3';
    $.ajax({
        type: "POST",
        url: url,
        data: $('#form').serialize(),
        dataType: 'json',
        success: function(data, status) {
            if (!data.resultCode) {
                $('#ajax').html($.base64.decode(data.html));
                $('#ajax').modal();
            } else {
                location.reload();
            }
        }
    });
    event.preventDefault();
});

```
[`getJSON`](http://api.jquery.com/jQuery.getJSON) is an AJAX method for retrieving JSON from a server, not for processing the data returned by another ajax method. Just remove it.

```
$('#form').live('submit', function(event) {
    var target = $('#ajax');
    var url = '/ajax/user/authenticateLevel3';
    $.ajax({
        type: "POST",
        url: url,
        data: $('#form').serialize(),
        dataType: 'json',
        success: function(data, status) {
            if (!data.resultCode) {
            $('#ajax').html($.base64.decode(data.html));
            $('#ajax').modal();
            } else {
                location.reload();
            }
        }
    });
    event.preventDefault();
});

```

Since you mentioned you are switching over to [`.on`](http://api.jquery.com/on), the syntax will be like this:

```
$(parent).on('submit', '#form', function(event) {
    /*
     * ...
     */
});

```

where `parent` is the nearest static parent element of `#form`.