У меня есть вызов AJAX для одного файла XML, и исходный код приведен ниже.Он отлично работает в Chrome, но не работает в Firefox.При выполнении отладки я вижу, что он не входит в цикл $ (response) .find ("simpleType"). Each (function () в Firefox.
Кто-нибудь знает, в чем здесь проблемамой код?
$.ajax({
type:"GET",
url:"views/workspace/branching_forms/StudentModelDescription.xml",
dataType:"xml",
error:function(XMLHttpRequest, textStatus, errorThrown){
alert("error="+XMLHttpRequest+" error2="+textStatus+" error3="+errorThrown);
},
success:function(response){
var i=1;
console.log("response="+response);
$(response).find("simpleType").each(function(){
adaptation_type_name[i]=$.trim($(this).find("documentation").text());
var restriction = $(this).find("restriction[base=xs:string]");
j=1;
var values=new Array();
$(restriction).find("enumeration").each(function(){
var tmp=$(this).attr("value");
values[j] = tmp;
j++;
});
adaptation_type_variables[i]=values;
console.log("adaptation_type_name="+adaptation_type_name[i]+", adaptation_type_variables="+adaptation_type_variables[i]);
i++;
});
for(var i=1;i<=adaptation_type_name.length;i++)
$('#adaptation_type_dialog #branching_adaptation_type').append($("<option></option>").attr("value",i).text(adaptation_type_name[i]));
}
});
Содержание StudentModelDescription.xml приведено ниже:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="browser" id="context_browser">
<xs:annotation>
<xs:documentation xml:lang="en">Web Browser</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="Safari" id="1" />
<xs:enumeration value="Google Chrome" id="2" />
<xs:enumeration value="Opera" id="3" />
<xs:enumeration value="Mozilla Firefox" id="4" />
<xs:enumeration value="Internet Explorer" id="5" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="networktype" id="context_networktype">
<xs:annotation>
<xs:documentation xml:lang="en">Network Type</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="ADSL2+/Cable (High capacity)" id="1" />
<xs:enumeration value="ADSL / HSPA (Moderate capacity)" id="2" />
<xs:enumeration value="Dialup / GPRS (Low capacity)" id="3" />
</xs:restriction>
</xs:simpleType>
</xs:schema>