SirChick
10-15-2012, 06:03 AM
Hey
I have a script which is meant to add to the div, but i don't want to add the content via the "call_back" div otherwise im limited on the dynamic possibilities. So i'm wondering how i do a request then "continue" from that request on wards if that makes sense... (i added comment where i refer to):
function call_back(result,div_id){
document.getElementById(div_id).innerHTML = result;
}
function caller(url,cfunc)
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=cfunc;
xmlhttp.open("GET",url,true);
xmlhttp.send();
}
function call_file(url,div_id){
caller(url,function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
call_back(xmlhttp.responseText,div_id);
}
});
}
window.onload = function() {
file = 'test.html';
div_id = 'test';
result = call_file(file,div_id);
call_file(file,div_id);
//something here to check "call_file" completed successfully then continue with code below
document.getElementById('test2').innerHTML = 'Hi'; //currently it says innerHTML is not found so i need to fix that
};
Any ideas on how to do this ?
I have a script which is meant to add to the div, but i don't want to add the content via the "call_back" div otherwise im limited on the dynamic possibilities. So i'm wondering how i do a request then "continue" from that request on wards if that makes sense... (i added comment where i refer to):
function call_back(result,div_id){
document.getElementById(div_id).innerHTML = result;
}
function caller(url,cfunc)
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=cfunc;
xmlhttp.open("GET",url,true);
xmlhttp.send();
}
function call_file(url,div_id){
caller(url,function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
call_back(xmlhttp.responseText,div_id);
}
});
}
window.onload = function() {
file = 'test.html';
div_id = 'test';
result = call_file(file,div_id);
call_file(file,div_id);
//something here to check "call_file" completed successfully then continue with code below
document.getElementById('test2').innerHTML = 'Hi'; //currently it says innerHTML is not found so i need to fix that
};
Any ideas on how to do this ?