guarda ti posto il codiche dentro il file
ajax.js
Codice PHP:
var myRequest = null;
function CreateXmlHttpReq2(handler) {
var xmlhttp = null;
try {
xmlhttp = new XMLHttpRequest();
} catch(e) {
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
xmlhttp.onreadystatechange = handler;
return xmlhttp;
}
function myHandler2() {
if (myRequest.readyState == 2){
e = document.getElementById("principale_box");
e.innerHTML='<div align="center">
Attendi il caricamento</div>';
}
if (myRequest.readyState == 4 && myRequest.status == 200) {
e = document.getElementById("principale_box");
e.innerHTML = myRequest.responseText;
}
}
function boxPrincipaleLoadContent(href_link,id_link) {
var href = href_link;
var id = id_link;
var r = Math.random();
myRequest = CreateXmlHttpReq2(myHandler2);
myRequest.open("GET","boxCentrale.php?content="+href+"&rand="+escape(r));
myRequest.send(null);
}
che viene richiamato dal div che contiene una lista( le tab in questione)
Codice PHP:
<div id="navigation">
<ul>
<li id="evidenzalink1">[url="index.php"]In Evidenza[/url]
<li id="evidenzalink2">[url="index.php"]VideoGallery[/url]
<li id="evidenzalink3">[url="index.php"]Ambulatori[/url]
<li id="evidenzalink4">[url="index.php"]Orari[/url]
[/list]
</div>
come puoi notare nell'onclick c'è il richiamo alla funzione ajax, come posso integrare il tuo codice nei miei?
sai non sono un granché con js-ajax