Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9214303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:56:45+00:00 2026-06-18T01:56:45+00:00

For the past few days I have been refactoring my javascript so it can

  • 0

For the past few days I have been refactoring my javascript so it can meet the requirement of working with IE7/8/9.

The code below takes in a filename from a select box and then makes an AJAX call to retrieve an XML file which is then serialized so it can be read.

It works perfectly fine with Firefox, Safari and Chrome.

Code

    //this function will take the parameter of filename to then make an AJAX request to the location of that file on a server
function getXML()
{
    //get filename from selection box "template_list"
    filename = $('#template_list').val();

    if (filename != "NULL")
        {
            //make AJAX request to server for template file 
            jQuery.ajax
            (
                {
                    type : "GET",
                    url : "xml\/" + filename,
                    dataType : "xml",
                    success : xmlToString
                }
            );
        }   
}

//loads xmlResponse from AJAX call into a string
function xmlToString(xmlResponse)
{

    try 
    {
        //For FF, Opera, Safari
        xml = (new XMLSerializer()).serializeToString(xmlResponse);
        writeEditDoc(xml);
    }

    catch (e) 
    {       
            // Internet Explorer.
            xml = new ActiveXObject("Microsoft.XMLDOM");
            xml.loadXML(xmlResponse);
            writeEditDoc(xml);
            //

    }

}

Error

Internet explorer does not like this line of code;

xml.loadXML(xmlResponse);

It throws

SCRIPT13: Type mismatch

What I have tried

  • Changing the datatype in the AJAX call from “xml” to “text/xml”
  • Using the native .xml() function within JS

I have seen on other posts about doing processing at the server side. However I cannot make any changes to the server as it is without the scope of this project.

EDIT Added XMl

<?xml version="1.0" encoding="UTF-8"?>

<text>${Prologue} </text>


<listOfTags>
    <Prologue fixed='n' size='100' type='textBox' value='' ></Prologue>
    <Title fixed='n' size='100' type='comboBox' value='' ></Title>
    <Surname fixed='n' size='100' type='textBox' value='' ></Surname>
    <ProductName fixed='n' size='100' type='textBox' ></ProductName>
    <VOLNumber fixed='n' size='100' type='numberBox' ></VOLNumber>
    <AppointmentDate fixed='n' size='100' type='datePicker' ></AppointmentDate>
    <AppointmentSlot fixed='n' size='100' type='datePicker' ></AppointmentSlot>
    <Epilogue fixed='n' size='100' type='textBox' ></Epilogue>
</listOfTags>


<listOfTypes>
    <textBox></textBox>
    <numberBox></numberBox>
    <datePicker></datePicker>
    <dropDown></dropDown>
    <timeBox></timeBox>
    <titleBox></titleBox>
</listOfTypes>

There must be some hack out there for this problem.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:56:45+00:00Added an answer on June 18, 2026 at 1:56 am

    Fixed myself,

    Confirmed working on IE7, IE9 and FF

        function getXML()
    {
    
        var xmlDoc;
        var xmlloaded = false;
    
        //get filename from selection box "template_list"
        var xmlFile = $('#template_list').val();
    
    
        if (xmlFile != "NULL")      
        {
    
            xmlFile = "xml\/" + xmlFile;
    
            try
            {
    
                var xmlhttp = new XMLHttpRequest();
                xmlhttp.open("GET", xmlFile, false);
                //console.log("1 getXML - Normal Path");
            }
    
            catch (Exception)
            {
                var ie = (typeof window.ActiveXObject != 'undefined');
    
                if (ie)
                {
    
                    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
                    xmlDoc.async = false;
                    while(xmlDoc.readyState != 4) {};
                    xmlDoc.load(xmlFile);
                    //console.log("1 getXML - IE Path");                
                    xmlToString(xmlDoc);
                    xmlloaded = true;
                }
                else
                {
    
                    xmlDoc = document.implementation.createDocument("", "", null);
                    xmlDoc.onload = xmlToString(xmlDoc);
                    //console.log("1 getXML - Else Case");
                    xmlDoc.load(xmlfile);
                    xmlloaded = true;
                }
            }
    
            if (!xmlloaded)
            {
    
                xmlhttp.setRequestHeader('Content-Type', 'text/xml')
                xmlhttp.send("");
                //console.log("1 getXML - End");
                xmlToString(xmlhttp.responseXML);        
                xmlloaded = true;
    
            }
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From the past few days, I have been working on an Android code to
I have been working on learning the Android NDK the past few days, but
ive been working on a javascript slider the past few days and to this
For past few days I had been working with MVC... I have to show
I have been working with Mahout in the past few days trying to create
I've been working on this for the past few days and I can't find
I have been working with Require.JS and SignalR over the past few days and
I have been working with the jQuery Grid the past few days and one
For the past few days I have been trying to play any sound over
There have been several questions over the past few days about the proper use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.