La llamada $ajax() funciona en Firefox, no en Webkit/Chrome

The following $ajax() call works fine from firefox but returns "error" status text and '0' status in webkit. The url is a cakePHP specific controller action that returns html. The Id passed to the ajax call comes from an option select and is functioning properly in both browsers.

$.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);
}

Does anyone have any ideas why this would work in firefox and not in Webkit/Chrome? I'm out of ideas.

preguntado el 04 de septiembre de 13 a las 02:09

Chrome: F12 -> Network tab, check the status, headers and response there. -

I wonder how the code shown is called. -

It is quite possible you're running into cross-site restrictions. As @FabrícioMatté said, check the Network tab for more details. -

update url like url : "/controller/controllername/action/", -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.