jquery 使用 settimeout 每两秒触发一次 ajax请求

function load() {
    setTimeout(function () {
        $.ajax({
            url: "includes/handlechat.php",
            type: "GET",
            data: data,
            dataType: 'json',  
            success: function (result) {
                $("#clog").empty();
                $.each(result, function (rowKey, row) {
                    $("#clog").append('<p ><h4>' + row.username + ':</h4>' + row.message_content + '</p>');
                });
            },
            complete: load
        });
    }, 1101);
}
load();

也可以使用IIFE的方式:

(function load() {
   // setTimeout here
}());