I am getting html data through js ajax function like this
function getData(dataSource,datasend)
{
var XMLHttpRequestObject = false;
if (window.XMLHttpRequest) {
XMLHttpRequestObject = new XMLHttpRequest();
} else if (window.ActiveXObject) {
XMLHttpRequestObject = new
ActiveXObject("Microsoft.XMLHTTP");
}
if(XMLHttpRequestObject) {
XMLHttpRequestObject.open("POST", dataSource, true);
XMLHttpRequestObject.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
XMLHttpRequestObject.send('data='+escape(datasend));
XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
document.getElementById(datafin).innerHTML = XMLHttpRequestObject.responseText;
//when the html has require data extecute this function
if(html has needed data for the function){
foo();
}
}
}
function foo(){
//stuff to do with the html when loaded
}
as far as i do it the html is generated by a php function. Now Is there way to trigger the foo()
function in the html data generated or a way to send data that can trigger the function. Thanks