Jquery load function throws "XML Parsing Error: not well-formed" error in firefox

Trying to load an xml file and getting the xml parsing error.

$("#analyticForm_description").load('', function() { MD.ui.editPallets.editform_definition(); } );

Should not throw any error. Note the url provided is valid and accessible from a browser directly. The function is also being called. Somehow even after the error reported on console, page loads successfully.

Do not want to see any errors reported on console.

10 thoughts on “Jquery load function throws "XML Parsing Error: not well-formed" error in firefox”

  1. I was also facing a similar error and upon search i stumbled upon this post, after debugging code for a while i found out the reason.

    Error shown in console

    XML Parsing Error: undefined entity
    Location: path-to-file.html#link3
    Line Number 26, Column 29:

    Here is why i was getting this error

    I was dynamically generating url that i want to hit, and due to some typo i was getting undefined as the url which was used in making ajax calls resulting in this issue

        url: dynamic_url(undefined),
        type: "get",
        data: data,
        contentType: "text/xml",
        success: function (response) {
            //some code

    Posting this as it might help someone facing the same issue.

  2. I think Firefox expects an Content-Type and Chrome ignores it.

        url : "",
        contentType: "text/xml",
        success : function(response) {

    or for the load method use ajaxSetup:

    Description: Set default values for future Ajax requests. Its use is
    not recommended.

      contentType: "text/xml"
    $("#analyticForm_description").load('', function() { 

Leave a Comment