I’m trying to download an XML file, but it does not have a .xml extension.
Example:
$.ajax({
type: "GET",
url: template.tmx,
dataType: "xml",
async: false,
success: function(xml, textStatus, jqXHR){
k.operations.load.processMap(xml);
}
});
However: this does not work. The success function is never fired.
If I remove the dataType: "xml", line, it actually does fire the success function.
But then it goes wrong. I can’t do anything with the result, for example in an $(xml).find(). Normally, when you pass an XML-string into jquery it should just process it, but it does not work.
You can find the xml file here:
http://kipdola.be/subdomain/kiflea/template.tmx
The extension won’t matter, but the MIME type does. Your resource emits
jQuery seems to refuse to process a response of that type as XML.
You need to either change the
content-typethe server emits for the resource, or, if you can’t, fetch the data using a “normal” Ajax request and parsing it manually.Edit: There seems to be a way to convert on the fly since jQuery 1.5: