I am trying to make an asynchronous request to get some data from my server. This all works perfectly well in Firefox but in Internet Explorer, the callback is being called immediately, before any data is received.
$.ajax({
url: "charts.php",
data: { site: site, start: toDateString(start), end: toDateString(end) },
cache: false,
dataType: "json",
success:
function(data) {
var dataPoints = [];
if(data.length == 0){
$("#error").children("label").eq(0).html("There were no results for the site and range selected.");
if($("#error").css("display") == "none"){
$("#error").toggle();
}
$("#large-loader").toggle();
return false;
}
//add each pair of time/maxcalls to an array
$.each(data, function(i, item){
var minute = item[0];
dataPoints.push({
label: pad(parseInt(minute / 60)) + ":" + pad((minute%60)),
data: [minute, item[1]]
});
});
var options = {
xaxis : {
ticks : 24,
tickSize: 60
},
legend : {
show: true,
margin: 10,
backgroundOpacity: .3
},
grid: {
hoverable: true
}
};
//hide loader, show chart
$("#large-loader").toggle();
$("#chart-container").toggle();
$.plot($("#chart"), [data], options);
}
});