Hi all,
I want help with a problem that I am dealing with. I ‘m having an ajax function that polls a server for a response. This response is in fact an html page which is dynamically constructed on the server. What I want is to be a able to replace my current html page ( not only the body ) with the html I am receiving as response from the server. I tried using document.write or innerHTML on html element but none of these does not seem to work. Here is a sample of the code I am using.
[code=php]
function ajaxCall()
{
var actionPath=window.location.href;
jQuery.ajax({
url: actionPath,
type: ‘GET’,
dataType: ‘html’,
error: function(){
alert (“ERROR”);
},
success: function(resp,textStatus){
document.getElementsByTagName(‘html’)[0].innerHTML = resp
}
});
}
jQuery(function() {
myInterval = setInterval(“ajaxCall()”, 10000);
});
If you have any suggestions I will be glad to hear.
Thanks.