0

以下 $ajax() 调用在 Firefox 中运行良好,但在 webkit 中返回“错误”状态文本和“0”状态。url 是一个 cakePHP 特定的控制器动作,它返回 html。传递给 ajax 调用的 Id 来自选项选择,并且在两个浏览器中都能正常运行。

$.ajax({
  type : "POST",
  url : "http://mysite.com/controller/controllername/action/",
  dataType: 'html',
  data: {'itemId':Id},
  success: ajaxSuccess,
  error: ajaxError,
  complete: ajaxComplete
});
function ajaxComplete(jqXHR, textStatus){
  console.log("complete: " + textStatus);
  console.log("complete: " + jqXHR);
}
function ajaxError(jqXHR, textStatus, errorThrown){
  console.log(errorThrown);
  console.log(textStatus);
  console.log(jqXHR);
}
function ajaxSuccess(result, status, jqXHR){        
 console.log(result);
}

有谁知道为什么这会在 Firefox 中而不是在 Webkit/Chrome 中工作?我没主意了。

4

0 回答 0