Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 11
  1. #1

    [ajax]difficoltà nell' uso di ajax

    Sto imparando ajax.
    Ho provato così :
    Codice PHP:
    <script language="JavaScript" >
    function 
    get_ajax() {
    var 
    XHR null,

     
    browserUtente navigator.userAgent.toUpperCase();
     if(
    typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object")
      
    XHR = new XMLHttpRequest();
     else if(
      
    window.ActiveXObject &&
      
    browserUtente.indexOf("MSIE 4") < 0
     
    ) {
      if(
    browserUtente.indexOf("MSIE 5") < 0)
       
    XHR = new ActiveXObject("Msxml2.XMLHTTP");
       
    XHR = new ActiveXObject("Microsoft.XMLHTTP");
     }

     return 
    XHR;
    }
    ajax get_ajax();
    if (
    ajax
    {
    ajax.open('GET','try.html');  
    ajax.setRequestHeader("connection""close");
    ajax.onreadystatechange = function() {
    if (
    ajax.readyState == 4  && ajax.status == 200) {
            
    document.write(ajax.responseText); 
        }
    }
    ajax.send(null);

    }

    </script> 
    Mi funziona su ie , non su firefox.
    Come creare e pubblicare ebook : Creare ebook

  2. #2

    Re: [ajax]difficoltà nell' uso di ajax

    Originariamente inviato da GiovanniP
    Sto imparando ajax.
    Ho provato così :
    Codice PHP:
    <script language="JavaScript" >
    function 
    get_ajax() {
    var 
    XHR null,

     
    browserUtente navigator.userAgent.toUpperCase();
     if(
    typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object")
      
    XHR = new XMLHttpRequest();
     else if(
      
    window.ActiveXObject &&
      
    browserUtente.indexOf("MSIE 4") < 0
     
    ) {
      if(
    browserUtente.indexOf("MSIE 5") < 0)
       
    XHR = new ActiveXObject("Msxml2.XMLHTTP");
       
    XHR = new ActiveXObject("Microsoft.XMLHTTP");
     }

     return 
    XHR;
    }
    ajax get_ajax();
    if (
    ajax
    {
    ajax.open('GET','try.html');  
    ajax.setRequestHeader("connection""close");
    ajax.onreadystatechange = function() {
    if (
    ajax.readyState == 4  && ajax.status == 200) {
            
    document.write(ajax.responseText); 
        }
    }
    ajax.send(null);

    }

    </script> 
    Mi funziona su ie , non su firefox.
    codice:
    if(XMLHttpRequest)
       XHR = new XMLHttpRequest();
       /*...*/

  3. #3
    Codice PHP:
    if
    (
    XMLHttpRequest)
       
    XHR = new XMLHttpRequest();
       
    /*...*/ 
    continua a non funzionare(per firefox).
    comunque il problema non é lì : l' assegnazione dell' oggetto xmlhttprequest viene eseguita correttamente.
    Come creare e pubblicare ebook : Creare ebook

  4. #4

  5. #5
    uncaught exception : Permesso negato al metodo di chiamata XMLHttpRequest.open
    Come creare e pubblicare ebook : Creare ebook

  6. #6
    codice:
    function ajax(){
            var req = null;
    	try{
    		req = new XMLHttpRequest();
    	}
    	catch(e){
    		try{
    			req = new ActiveXObject("Microsoft.XMLHTTP");
    		}
    		catch(ex){
    			try{
    				req = new ActiveXObject("Msxml2.XMLHTTP");
    			}
    			catch(exx){
    				req = false;
    			}
    		}
    	}
            return req;
    }
    Prova così


  7. #7
    fatto ma non cambia nulla , mi restituisce sempre lo stesso errore.
    Come creare e pubblicare ebook : Creare ebook

  8. #8
    codice:
    ajax.open('GET','try.html', true);

  9. #9
    fatto ma continua a non funzionare su firefox .
    firebug restituisce sempre lo stesso messaggio di errore ...
    Come creare e pubblicare ebook : Creare ebook

  10. #10
    up
    Come creare e pubblicare ebook : Creare ebook

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 © 2026 vBulletin Solutions, Inc. All rights reserved.