did you try to attach a ready event to your document you can try something like below,
var post = new XMLHttpRequest();
post.open('POST', data);
post.onload = function() {
var do = document.open("text/html", "replace");
$(do).ready(function () { goOn(); });
do.write(post.responseText);
do.close();
}
function goOn() {
console.log($('img:visible'));
}
EDIT:
Yes I tried on fiddler but there is JS event for that like below and here
var docx = document.open();
docx.onreadystatechange = function () { alert(this.readyState) };
alert(docx);
docx.write("<div>test test test test ttetst <br /></div><div>test test test test ttetst <br /></div><div>test test test test ttetst <br /></div><div>test test test test ttetst <br /></div><div>test test test test ttetst <br /></div><div>test test test test ttetst <br /></div><div>test test test test ttetst <br /></div><div>test test test test ttetst <br /></div>");
docx.close();
after that just check the ready state and do your stuff when it complete
.
I think this one ll do the trick.