Using AJAX to load an XML File

I’ve been going nuts for the past 6 hours trying to get this little script to work, but it simply doesn’t!

My goal here is to have it so that when I click box on this page, it will load my WoW character’s information into it, but in the .xml format it should be in to begin with (i.e. <characterinfo><name>blah</name> etc).

I’ve noticed that if I view the site in Safari (I’m a Mac user) it will format the page into HTML, however if I view it in Firefox, it will stay nice and pretty in its XML format.

So, this brings me onto some of my problems.

Can I, simply via AJAX and Safari, have the Armory page come up in XML, and if so, can I have that XML ported to my .html file.

My current code is:

<script type="text/javascript" language="javascript">

    function makeRequest(url) {
        var httpRequest;

            httpRequest = new XMLHttpRequest();
        if (!httpRequest) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;

        httpRequest.onreadystatechange = function() { alertContents(httpRequest); };'GET', url, true);


    function alertContents(httpRequest) {

        if (httpRequest.readyState == 4) {
            if (httpRequest.status == 200) {

             window.document.getElementById('out').innerText = httpRequest.responseText;

	    // var xmldoc = httpRequest.responseXML;
	    // var root_node = xmldoc.getElementsByTagName('page');
	    // alert(;

            } else {
                alert('There was a problem with the request.');


This works, however it spits out the HTML, which I do not want. Additionally, it gives me the HTML in plain text, so it doesn’t actually show up as a formatted page, it shows up as <html><blah><blah>.

I understand I have to use what I’ve commented off, responseXML, however when I set it to that I am not getting ANYTHING.

For reference, this is the page I want to be loading:

Any help is much appreciated.