Ajax Talk - Asynchronous javascript and xml discussion board
 FAQ   Search    Usergroups      Register   Profile   Check your messages   Log in 
Signup now to enjoy a range of free membership advantages !!
Ajax Talk - Moderators Wanted
onreadystatechange Call Back Function Not Running

 
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help
View previous topic :: View next topic  
Author Message
pyr0
New one
New one


Joined: 17 Apr 2008
Posts: 1

PostPosted: Thu Apr 17, 2008 10:11 am    Post subject: onreadystatechange Call Back Function Not Running Reply with quote

Hi,

I have written a small Javascript app that loads a few XML files.

The code for loading the XML files is below:
Code:

function loadXMLFile(url, func) {
    // If proper browser use the native XMLHttpRequest object.
    if (window.XMLHttpRequest) {
        try{
            // Instantiate an XMLHttpRequest object.
            req = new XMLHttpRequest();
            // Set the process function to the one provided.
            req.onreadystatechange = func;
            // Set the request object to read mode.
            req.open("GET", url, false);
            // Finalise the setup.
            req.send(null);
        }catch (e){
            alert("XML File Load Failed: " + e.message);
        }
    // Otherwise if IE/Windows use ActiveX version.
    } else if (window.ActiveXObject) {
        try{
            // Instantiate an XMLHttpRequest object.
            req = new ActiveXObject("Microsoft.XMLHTTP");
            // If IE manages to do it's job and instantiate
            // the object...
            if (req) {
                // Set the process function to the one provided.
                req.onreadystatechange = func;
                // Set the request object to read mode.
                req.open("GET", url, false);
                // Finalise the setup.
                req.send();
            }
        }catch (e){
            alert("XML File Load Failed: " + e.message);
        }
    }
}



My problem is in Firefox on Linux the onreadystatechange call back function is not being run.

Does anyone know why this might be happening?


Also when I try and run this code on any other computer other than the one I wrote it on I keep getting Permission Denied exceptions when I try and load the XML files. Why would this be happening?


I am also trying to run this code from a local file not through a webserver.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
 Advertisements
 XML & Copyright Notice 
    


Powered by phpBB © 2001, 2005 phpBB Group

What is according to Wikipedia: Ajax Web2.0 XML E4X


Link to our site:

  


del.icio.us digg spurl wists simpy newsvine blinklist furl blogmarks yahoo! myweb smarking ma.gnolia segnalo reddit fark technorati cosmos


Normal Bookmark


Partner Button Links:
Codecrunch.com: Webmaster Tutorials    One Ajax


Partner Text Links:
quomon | web20log | ajaxmatters | tableless | 456bereastreet | music charts | gift ideas | competitions | free xbox 360 | link trade ?


Credits:
it consultancy & project management lead generation zoekmachine optimalisatie steal these buttons seo expert