Ajax timeout test

Testing jQuery Ajax timeout.

by Alex Azuero

JavaScript

$.ajax({
    type: 'POST',
    url: '/echo/json/',
    data: {
        json: JSON.stringify({
            text: 'some text',
            array: [1, 2, 'three'],
            object: {
                par1: 'another text',
                par2: [3, 2, 'one'],
                par3: {}
            }
        }),
        delay: 6000
    },
    dataType: 'JSON',
    timeout: 1000
}).done(function (data, status, xhr) {
    alert('success:  ' + status);
}).fail(function (xhr, statusText) {
    alert('fail: ' + statusText);
});