Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    AJAX responseText display in Firefox

    I'm dynamically creating a few sections of my page using AJAX by gathering some names from an external site and displaying them on the page. Everything works fine in Safari, but when I view the gathered names using Firefox, I see question marks wherever there should be certain special characters (most notably, spanish accents).

    I've set my page to be the same encoding as the page I'm gathering the names from (ISO-8859-1), and even set Firefox to encode characters with ISO-8859-1 as well, but am still seeing the question marks. It works beautifully in Safari. Any ideas?

    Here's the code I use to generate the dynamic content with AJAX:

    Code:
    var response=xmlHttp.responseText;
    var names = response.split(",");
    
    var nameList = "<ul>";
    			
    for(var i=0; i<names.length; i++){			
         nameList += "<li>" + names[i] + "</li>";
    }
    		
    nameList += "</ul>";
    
    var nameBox = document.getElementById("nameBox");
    nameBox.innerHTML = nameList;
    Thanks in advance!

  • #2
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Managed to fix the problem with:

    Code:
    xmlHttp.overrideMimeType('text/xml; charset=iso-8859-1');
    works like a charm!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •