Visualizzazione dei risultati da 1 a 4 su 4
  1. #1
    Utente di HTML.it L'avatar di henry78
    Registrato dal
    May 2001
    Messaggi
    1,264

    [Ajax] problemino con passaggio parametri ..

    ciao a tutti
    ho questa semplice funzione Ajax:


    var XMLHTTP;

    function RichiestaAJAX(livello,stringa)
    {

    //alert(livello);
    if (stringa.length > 0)
    {
    var url = "pippo.asp?data=" + stringa.toUpperCase();
    XMLHTTP = QualeBrowser(GestioneStato(livello));
    XMLHTTP.open("GET", url, true);
    XMLHTTP.send(null);
    }
    else
    {
    document.getElementById(livello).innerHTML = "";
    }
    }

    function GestioneStato(livello)
    {
    if (XMLHTTP.readyState == 4)
    {
    var R = document.getElementById(livello);
    R.innerHTML = XMLHTTP.responseText;
    }
    }

    function QualeBrowser(QualeBrowser)
    {
    if (navigator.userAgent.indexOf("MSIE") != (-1))
    {
    var Classe = "Msxml2.XMLHTTP";
    if (navigator.appVersion.indexOf("MSIE 5.5") != (-1));
    {
    Classe = "Microsoft.XMLHTTP";
    }
    try
    {
    OggettoXMLHTTP = new ActiveXObject(Classe);
    OggettoXMLHTTP.onreadystatechange = QualeBrowser;
    return OggettoXMLHTTP;
    }
    catch(e)
    {
    alert("Errore: l'ActiveX non verrà eseguito!");
    }
    }
    else if (navigator.userAgent.indexOf("Mozilla") != (-1))
    {
    OggettoXMLHTTP = new XMLHttpRequest();
    OggettoXMLHTTP.onload = QualeBrowser;
    OggettoXMLHTTP.onerror = QualeBrowser;
    return OggettoXMLHTTP;
    }
    else
    {
    alert("L'esempio non funziona con altri browser!");
    }
    }


    la richiamo dalla pagina madre così:

    <body onLoad="RichiestaAJAX('nomi','02/07/2007')">
    <div id="nomi" class="testo1"></div>

    mi restituisce un errore:

    XMLHTTP.readyState è nullo e non è un oggeto...

    dov'e' l'errore??

  2. #2
    Utente di HTML.it L'avatar di henry78
    Registrato dal
    May 2001
    Messaggi
    1,264
    se gli passo i parametri "a mano" tutto funziona...

    boh... :master:

  3. #3
    Utente di HTML.it L'avatar di henry78
    Registrato dal
    May 2001
    Messaggi
    1,264
    nessuno mi sa aiutare ??

  4. #4
    Utente di HTML.it L'avatar di henry78
    Registrato dal
    May 2001
    Messaggi
    1,264
    nessuno mi sa aiutare ??

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.