我有超過100個Ajax請求,尤其取決於它在頁面上有多少個.miniCanvas
類。我想發送下一個Ajax請求,因爲我收到了以前的Ajax響應。Ajax請求一步一步
這是我的代碼:
$def(".miniCanvas").each(
function()
{
getChartData($def(this));
});
function getChartData(me)
{
$def.ajax(
{
url: 'allmoves.php?path=getchart&'+me.attr('id'),
cache: false,
success:function(msg){handleChartData(msg, me)},
error: function(msg){alert('Error loading data.')}
});
}
function handleChartData(data, me)
{
var aData = new Array();
id=me.children('div').attr('id');
var plot1 = $def.jqplot (id, [JSON.parse(data)],
{
series:[{showMarker:false}],
axesDefaults: {
show: false,
showTicks:false
}
});
}