I am using this AJAX code to loading a PHP page to change the ORDER BY
for a MySQL clause. Also i have a function called getDESC
.
Now I want to expand this two codes that there are get two PHP documents. These are katbox with kate.php. Is that possible and can you help to write this code?
function getASC()
{
xmlHttp = CreateXmlHttpObjet();
if (xmlHttp == null)
return;
xmlHttp.onreadystatechange = function() {
document.getElementById('ascbox').innerHTML = xmlHttp.responseText;
};
xmlHttp.open('GET', 'asc.php', true);
xmlHttp.send(null);
}
Just update your function like so, now you can call getAJAX('ascbox', 'asc.php')
and getAJAX('katbox', 'kate.php')
function getAJAX(id, php)
{
xmlHttp = CreateXmlHttpObjet();
if (xmlHttp == null)
return;
xmlHttp.onreadystatechange = function() {
document.getElementById(id).innerHTML = xmlHttp.responseText;
};
xmlHttp.open('GET', php, true);
xmlHttp.send(null);
}