Visualizzazione dei risultati da 1 a 6 su 6
  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2008
    Messaggi
    16

    Funzioni ajax non funzionano :D

    Ciao a tutti, è il mio primo messaggio, e vorrei subito porvi un quesito, ho scritto questo codice dopo aver visto diversi tutorials, ma non capisco xkè non funzioni... -.- PS: uso firefox

    var ab=null;
    function CXHR(handler) {
    var xmlhttp=null;
    xhtmlhttp = new XMLHttpRequest();
    xhtmlhttp.onreadystatechange(handler);
    return xmlhttp;
    }

    function HAN() {
    if (ab.readyState == 4 && ab.status == 200) {
    alert(action.responseText);
    }
    }

    function ES() {
    ab = CXHR(HAN);
    ab.open("GET", "2.html");
    ab.send(null);
    }
    richiamo ES tramite on click.... aiutatemi x favore...

  2. #2
    Uhm .. un paio di errori: (in rosso )
    codice:
    var ab=null;
    function CXHR(handler) {
    var xmlhttp=null;
    xhtmlhttp = new XMLHttpRequest();
    xhtmlhttp.onreadystatechange = handler;
    return xmlhttp;
    }
    
    function HAN() {
    if (ab.readyState == 4 && ab.status == 200) {
    alert(ab.responseText);
    }
    }
    
    function ES() {
    ab = CXHR(HAN);
    ab.open("GET", "2.html");
    ab.send(null);
    }
    HTH
    Zappa
    [PC:Presario 2515EU][Cpu:P4@2.3GHz][Ram: 512M][HDU:80G@5400 RPM]
    [Wireless:LinkSys][OS: Ubuntu 9.04 - Jaunty Jackalope]

  3. #3
    Utente di HTML.it
    Registrato dal
    Oct 2008
    Messaggi
    16
    uhm, scusami ma xkè sarebbero errori? XD

  4. #4
    scusa tu, che non ho visto gli altri!
    codice:
    var ab=null;
    function CXHR(handler) {
    var xmlhttp=null;
    xmlhttp = new XMLHttpRequest();
    xmlhttp.onreadystatechange = handler;
    return xmlhttp;
    }
    
    function HAN() {
    if (ab.readyState == 4 && ab.status == 200) {
    alert(ab.responseText);
    }
    }
    
    function ES() {
    ab = CXHR(HAN);
    ab.open("GET", "2.html");
    ab.send(null);
    }
    Se confronti con il tuo codice, vedrai perchè
    Se non vedi il perchè, beh, mi arrendo!
    (hai dichiarato una variabile, poi hai assegnato un valore ad un'altra, per poi tornare la prima)
    Mai programmato, eh? (non dico in javascript, suppongo in nessun linguaggio)

    HTH
    Zappa
    ... semiaddormentato ... scusabile?
    [PC:Presario 2515EU][Cpu:P4@2.3GHz][Ram: 512M][HDU:80G@5400 RPM]
    [Wireless:LinkSys][OS: Ubuntu 9.04 - Jaunty Jackalope]

  5. #5
    Utente di HTML.it
    Registrato dal
    Oct 2008
    Messaggi
    16
    a dire ilv ero progrmmo in php ed anche abbastanza bene... quel codice è in pratica copiato da una guida.. bah, meglios e lo imparo da solo ajax

  6. #6

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.