My js code is not working with document loaded via ajax.
Below is ajax code :
var xhr;
xhr = new XMLHttpRequest();
function xhrDocOpen(doc,placeID){
xhr.onreadystatechange=function(){
if(xhr.readyState==4 && xhr.status==200){
document.getElementById(placeID).innerHTML=xhr.responseText;
}
}
xhr.open('GET',doc,true);
xhr.send();
}
As you see, it's pure js code. do not using jquery. I saw some of solutions in here, they were all using jquery..(example: success {js code})
But I want to solve the problem with pure js code.
How can I do that?