dracula51
10-29-2009, 05:01 AM
hey.
i hav a file, suppose, name.php. it contains various things with a <div id="ajax-content">
another file is name_ajax.php
i use these codes to load contents from name_ajax.php in name.php's DIV
var xmlHttp
function pagination(page)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="name_ajax.php?starting="+page;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged()
{
if (xmlHttp.readyState==4)
{
document.getElementById("ajax-content").innerHTML=xmlHttp.responseText;
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
actually i use it for an ajax pagination system.
btw, in name_ajax.php there are some javascript code. & they r not working when loaded in name.php's DIV area
thats the problem JS is not working when loaded via ajax
plz help me
ps: sorry for bad english & im not an expert JS coder
i hav a file, suppose, name.php. it contains various things with a <div id="ajax-content">
another file is name_ajax.php
i use these codes to load contents from name_ajax.php in name.php's DIV
var xmlHttp
function pagination(page)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="name_ajax.php?starting="+page;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged()
{
if (xmlHttp.readyState==4)
{
document.getElementById("ajax-content").innerHTML=xmlHttp.responseText;
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
actually i use it for an ajax pagination system.
btw, in name_ajax.php there are some javascript code. & they r not working when loaded in name.php's DIV area
thats the problem JS is not working when loaded via ajax
plz help me
ps: sorry for bad english & im not an expert JS coder