Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A jQuery plugin that simulate latency for any AJAX request via jQuery plugin
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

jQuery AJAX Latency Simulator Plugin

This is a jQuery plugin that simulates HTTP latency when requesting resources using jQuery.ajax. This plugin affect all jQuery functions related to AJAX since all of these functions internally use jQuery.ajax.

This plugin it is not designed for production use. Instead it was developed to simulate latency when developing a jQuery web application locally, where resources that are requested via AJAX are delivery too fast.

How to use it?

It should be simple, and it is. It takes one line after including jQuery and the plugin (of course!).

    <script type="text/javascript" src="/path/to/jquery.js"></script>
    <script type="text/javascript" src="/path/to/jquery.ajax.latency.simulator.js"></script>
    <script type="text/javascript">
      jQuery(function($) {
        // All AJAX request will be delayed by 5000 ms.
        $.fn.ajaxLatencySimulator({delay : 5000});

I told you that is just that simple.

Any options (aka documentation)?

You can configure the behaviour of the latency. It could be linear (as in the previous example) or variable. The following snippet shows you how to get a linear or a variable latency.

// I would like a linear latency of 3.5 seconds.
$.fn.ajaxLatencySimulator({delay : 3500});

// I would like a variable latency from 2 seconds to 6 seconds.
$.fn.ajaxLatencySimulator({min : 2000, max : 6000});

And that's all.

Something went wrong with that request. Please try again.