How to check if DOM is ready on ajax?

Maybe you need to check if the DOM is already loaded but you need to do it with ajax, you can use the code below or as I named, the equivalent of windows.load on jquery is:

var chkReadyState = setInterval(function() {
    if (document.readyState == "complete") {
        // clear the interval
        clearInterval(chkReadyState);
        // finally your page is loaded.
    }
}, 100);