sono io andrea scusa se non mi sono spiegato bene per quanto riguarda jquery..allora quello che voglio provare a fare e aggiungere un immagine di caricamento a questo script.In pratica carica in un div una pagina esterna.
L altra mia domanda e se io ho un bottone che al click apre un div come faccio a fare comparire un immagine di caricamento che duri il tempo reale del caricamento del div..Come dicevi tu il caricamento di un div e istantaneo ma non lo e se ci sono tantissime persone che fanno la stessa richiesta nello stesso istante..grazie e scusa ancora dell incomprensione..
Questo e un esempio che ho trovato del caricamento di una pagina esterna.
<script>function ahah(url, target) {
document.getElementById(target).innerHTML = ' Fetching data...';
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
if (req != undefined) {
req.onreadystatechange = function() {ahahDone(url, target);};
req.open("GET", url, true);
req.send("");
// otherwise display an error message
}
}
function ahahDone(url, target) {
if (req.readyState == 4) {// only if req is "loaded"
if (req.status == 200) { // only if "OK"
document.getElementById(target).innerHTML = req.responseText;
} else {
document.getElementById(target).innerHTML=" AHAH Error:\n"+ req.status + "\n" +req.statusText;
}
}
}
function load(name, div) {
ahah(name,div);
return false;
}</script>
File 1![]()
![]()
![]()