1

I know this has been asked many times, but the answers given there did not work for me.

I think I am doing a very common request to fetch an xml resource:

$(document).ready(function() {
    $.ajax({
      type: "GET",
      url: "data.xml",
      dataType: "xml",
      success: function(xml) {
        $(xml).find("main").each(function() {
          alert($(this).attr("val"));
        });
      }
    });

The full file can be found here, and the xml resource here.

When I access this with Firefox 36.0.4, I am greeted by an "hello world" alert as expected, but the javascript console lists the errors:

http://esel7353.org/ : Unable to run script because scripts are blocked internally.

not well-formed :1:76

In many questions asked here, the content type header in the response was inaccurate, but in my case the server tells firefox, that data.xml is application/xml.

In addition the mimeType option does not help.

I also made an clean FF profile to ensure that this is not somehow cause by plugins, but the error messages persist.

Community
  • 1
  • 1
sauerburger
  • 4,569
  • 4
  • 31
  • 42
  • I get no error at all with FF 36 and chrome 41... – Jeremy Thille Mar 23 '15 at 14:52
  • I've tested it on two computers running on ubuntu and arch linux, and on both I get the same error. I agree that chrome does not report anything. – sauerburger Mar 23 '15 at 15:02
  • and on a vm with win 7 and FF 34, 35, 36 I get the same error. – sauerburger Mar 23 '15 at 15:05
  • 1
    See this post http://stackoverflow.com/questions/677902/not-well-formed-error-in-firefox-when-loading-json-file-with-xmlhttprequest and especially this comment : "req.overrideMimeType("application/json"); req.send(null); works". Maybe it will help (replacing json with xml, of course)... – Jeremy Thille Mar 23 '15 at 15:11
  • I read that too, and it works indeed: http://esel7353.org/json.htm, but I wonder what's the problem with xml. – sauerburger Mar 23 '15 at 15:32
  • I can't say if it works better, still have no errors :o) – Jeremy Thille Mar 23 '15 at 15:33
  • I've tested it with an clean ubuntu 14.04 live dvd, and get the same error. Seems like a bug in ff or ubuntu, which also affects the vm. Thanks @JeremyThille for your replies. – sauerburger Mar 30 '15 at 10:10
  • You forgot to close $(document).ready(function() {. The last " }); " is missing. – user1511417 Jul 21 '15 at 12:39
  • possibly related to http://stackoverflow.com/questions/30062247/jquery-call-to-find-function-gives-a-not-well-formed-error-in-firefox – aland Nov 28 '15 at 23:41

1 Answers1

0

I wrote this in another question - but since your question is also unanswered I will post it here too.


I can't say for sure that it will fix your problem, but I had similar issues with the 'not well-formed' message in firefox. Turns out there is a bug in jQuery 1.11.2 and 1.11.3 - https://github.com/jquery/jquery/issues/1969 - which is fixed upstream.

It's a relatively minor change if you host jquery on your server - see the github commit

on jquery.1.11.3.js line cca 1197 (in QSA/matchesSelector section):

 -              "<select id='" + expando + "-\f]' msallowcapture=''>" +
 +              "<select id='" + expando + "-\r\\' msallowcapture=''>" +

Hopefully there will be a new release soon.

Community
  • 1
  • 1
aland
  • 1,824
  • 2
  • 26
  • 43