尝试加载 xml 文件并收到 xml 解析错误。
$("#analyticForm_description").load('https://192.168.23.10/SystemServices/main?system:run=html/indicators/templates/editApp-definition.xml&Id=1000205&palletId=testtt', function() { MD.ui.editPallets.editform_definition(); } );
不应引发任何错误。请注意,提供的 URL 有效且可直接从浏览器访问。该函数也正在被调用。不知何故,即使在控制台上报告错误后,页面也成功加载。
不想看到控制台上报告的任何错误。
最佳答案
我认为 Firefox 需要 Content-Type,而 Chrome 会忽略它。
$.ajax({
url : "https://192.168.23.10/SystemServices/main?system:run=html/indicators/templates/editApp-definition.xml&Id=1000205&palletId=testtt",
contentType: "text/xml",
success : function(response) {
$("#analyticForm_description").html(response);
}
});
或者对于加载方法使用 ajaxSetup :
Description: Set default values for future Ajax requests. Its use is not recommended.
$.ajaxSetup({
contentType: "text/xml"
});
$("#analyticForm_description").load('https://192.168.23.10/SystemServices/...', function() {
MD.ui.editPallets.editform_definition();
});
关于javascript - jquery加载函数在firefox中抛出 "XML Parsing Error: not well-formed"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47708998/