AJAX spiegato da MS

Un articolo pubblicato pochi giorni fa sulla Knowledge Base di Microsoft spiega come implementare, usando Javascript, MSXML, e un webservice fatto in C#, una pagina che si aggiorna direttamente senza fare dei postback sul server.

Qui potete trovare l'intero documento in questione

Dynamic page updates using XMLHTTP

Ovviamente nel codice presentato pensano che esista solo IE

// create the XML object
    
objXmlDoc = new ActiveXObject("Msxml2.DOMDocument");

    
if (objXmlDoc == null)
    {
            alert("Unable to create DOM document!");

    } 
else {

        
// create an XMLHTTP instance
        
objHttp = new ActiveXObject("Microsoft.XMLHTTP");

ma basta modificare la chiamata in modo che istanzi l'XMLHttpRequest per renderlo compatibile anche con i browser che non supportano gli ActiveX, sostituendo il messaggio d'errore con

objHttp = new XMLHttpRequest();

A merito di Microsoft va però detto che nonostante questa "ovvia" preferenza per IE stanno cmq cercando di standardizzarsi:

Note Microsoft does offer a Web Service behavior for Internet Explorer that makes asynchronous calls to ASP.NET Web services quick and easy. However, this behavior is not supported and it's not the best way to update a page asynchronously. You should use XMLHTTP instead!

powered by IMHO 1.2

posted @ mercoledì 13 aprile 2005 12:26

Print

Comments on this entry:

# re: AJAX spiegato da MS

Left by Simone Chiaretta at 13/04/2005 12:59
Gravatar
Scusa, ora è sistemato...
IMHO ogni tanto sega gli URL inseriti...

# re: AJAX spiegato da MS

Left by Paolo at 13/04/2005 13:22
Gravatar
thanks!

# re: AJAX spiegato da MS

Left by Simone Chiaretta at 13/04/2005 14:19
Gravatar
Non ancora, sono prigro, non ho voglia di reinserire tutti i dati di conf

# re: AJAX spiegato da MS

Left by Lorenzo Barbieri at 13/04/2005 18:46
Gravatar
Che dati devi reinserire che li tiene tutti... tranne le categorie che si risincronizzano con un pulsante... e almeno non posti i link sbagliati... :-(

# re: AJAX spiegato da MS

Left by Simone Chiaretta at 13/04/2005 20:02
Gravatar
lo scaricherei, se il sito funzionasse :-)

# AJAX per .ASP.NET

Left by FoxyBlog at 12/07/2005 21:02
Gravatar

# AJAX per .ASP.NET

Left by FoxyBlog at 12/07/2005 21:04
Gravatar

# Sempre pi

Left by FoxyBlog at 18/07/2005 12:49
Gravatar

# Sempre pi

Left by FoxyBlog at 18/07/2005 12:52
Gravatar

# re: AJAX spiegato da MS

Left by Matteo Casati at 08/11/2005 13:28
Gravatar
Ho scritto una semplice libreria JavaScript (meno di 8 KB) che fa praticamente la stessa cosa.
Se avete tempo e voglia date un occhio qui:

http://www.guru4.net/articoli/javascript-soap-client/

e magari fatemi sapere cosa ne pensate.

P.S.: funziona con IE, FF, Safari, ecc. :-)

# IE7 supporter

Left by FoxyBlog at 24/01/2006 23:03
Gravatar
Comments have been closed on this topic.
«luglio»
domlunmarmergiovensab
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910