Edit in JSFiddle

$(function () {
    var start = Date.now();

    setTimeout(function () {
        console.log('First timeout', Date.now() - start);
    }, 0);

    $.ajax('/echo/html/', {
        method: 'POST',
        data: {
            html: "<p>Text echoed back to request</p>" + "<script type='text/javascript'>$('target').highlight();<\/script>",
            delay: 1
        },
        success: function (data) {
            console.log('IO', Date.now() - start);
        }
    });

    setTimeout(function () {
        console.log('Second timeout', Date.now() - start);
    }, 3000);

    // uncomment following line to show a different result
    /*
    while(1) {
        if ((Date.now() - start) > 5000) {
            break;
        }
    }
    */
});