我从JavaScript调用SOAP WebService。在IE中,我的代码工作,但在Firefox上,错误函数被调用textStatus =“error”,xhr.status = 0,errorThrown为空。我尝试了不同的答案,发现在SO上,但无法解决问题。jQuery.ajax调用适用于IE,但在Firefox上失败
jQuery.support.cors = true;
jQuery.ajax({
url: serviceUrl,
beforeSend: function (xhr) {
xhr.setRequestHeader("SOAPAction", soapAction);
},
type: "POST",
dataType: "xml",
data: soap,
success: function(data, textStatus, jqXHR) {
// report success
success.style.display='block';
},
error: function (jqXHR, textStatus, errorThrown) {
// report error
fail.style.display='block';
alert(textStatus + ": " + jqXHR.status + "/" + errorThrown);
},
contentType: "text/xml; charset=utf-8"
});
Browserversions:IE 9,火狐23.0.1
是否有任何错误记录到Firefox的开发者控制台? – phuzi
我检查了Web开发人员错误控制台,没有错误... – Hinek