下面的ajax请求在所有浏览器中都可以工作,但在chrome 28.XX版中不起作用。请有人告诉我,这段代码有什么问题?
var output = '';
$.ajax({
url : "PageController/CurrencyController.php",
data : formData,
dataType : "text",
async : false,
success : function(html, textStatus, XMLHttpRequest) {
alert(" ajax done"+html);
if ( html != '' ) {
output = html;
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert("Req "+XMLHttpRequest +" status "+textStatus+" Error "+errorThrown);
}
});alert(" ajax done"+html);不工作在Chrome,但提供弹出在其他浏览器。
发布于 2013-08-16 13:05:01
可能问题是使用XMLHttpRequest作为函数参数名。那是个保留词。试着改变它,xhr。
var output = '';
$.ajax({
url : "PageController/CurrencyController.php",
data : formData,
dataType : "text",
async : false,
success : function(html, textStatus, xhr) {
alert(" ajax done"+html);
if ( html != '' ) {
output = html;
}
},
error : function(xhr, textStatus, errorThrown) {
alert("Req "+xhr+" status "+textStatus+" Error "+errorThrown);
}
});https://stackoverflow.com/questions/18273219
复制相似问题