ho il seguente chiamata AJAX che funziona perfettamente in Firefox e Chrome, ma non IE:
function getAJAXdates(startDate, numberOfNights, opts) {
var month = startDate.getMonth() + 1;
var day = startDate.getDate();
var year = startDate.getFullYear();
var d = new Date();
var randNum = Math.floor(Math.random()*100000000);
$.ajax({
type : "GET",
dataType : "json",
url : "/availability/ajax/bookings?rand="+randNum,
cache : false,
data : 'month='+month+'&day='+day+'&year='+year+'&nights='+numberOfNights,
contentType : 'application/json; charset=utf8',
success : function(data) {
console.log('@data: '+data);
insertCellData(data, opts, startDate);
},
error:function(xhr, status, errorThrown) {
console.log('@Error: '+errorThrown);
console.log('@Status: '+status);
console.log('@Status Text: '+xhr.statusText);
}
});
}
So per certo che tutti i le variabili stanno passando il giusto contenuto e $ .ajax sta effettivamente superando tutti i parametri/valori.
Questo è ciò che ottengo in caso di errore:
LOG: @Error: undefined LOG: @Status: ParserError LOG: @Status Testo: OK
Sono consapevole del problema cache IE e implementato un parametro casuale per eliminarlo.
Ecco il JSON torno (io sono in grado di vederla con Charles)
{
"availability":[
{
"inventory_id":"5",
"booking_id":"21",
"start_date":"05-01-2010",
"number_nights":4,
"text":"deFrancisco, Martin - $500.00 ACTIVE",
"type":"BOOKING"
}
]
}
Infine queste sono le intestazioni che vengono inviati indietro dal backend:
header('Content-Type: application/json; charset=utf8');
header("Cache-Control: no-cache");
header("Expires: 0");
header('Access-Control-Max-Age: 3628800');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
Eventuali idee?
ho aggiunto contentType per vedere se risolve il problema ma non funziona anche senza. grazie – Sam3k