我有一个YR.printGraphs()函数。这会执行许多ajax调用并绘制图形。
我必须在完成所有ajax调用后执行一些脚本,但我无法做到这一点。我尝试了以下,也推迟了注意似乎对我有用。
“sangeetha”功能从未发射过。我做错了什么?
$("#pnlEmail1").ready(function () {
YR.printGraphs();
}).sangeetha();
function sangeetha() {
var s = 0.0;
$(".printgraphs").each(function () {
s += parseFloat($(this).height());
});
s = s - parseFloat($("#pnlEmail1").height());
$(".fulldtls").css({ "top": s + "px", "position": "relative" });
}
printGraphs: function () {
///<summary>Loop through the email metrics available for this customer and makes ajax calls to get the email graph data.</summary>
$(".printgraphs").each(function () {
//Every div id is generated with its respective tab name in printreport.cs to distingush graphs.
// So, check if the div belongs to Email tab, Phone tab or Grades and send the respective tab name to controller to get the correct graph data.
if ($(this).attr("id").toLowerCase().indexOf("email") >= 0) {
YAHOO.Report.changeGraph("Email", $(this), true);
}
else if ($(this).attr("id").toLowerCase().indexOf("grade") >= 0) {
YAHOO.Report.changeGraph("Grades", $(this), true);
}
else {
YAHOO.Report.changeGraph("Phone", $(this), true);
}
});
}
每个YAHOO.Report.changeGraph都会进行一次ajax调用。我听说过jQuery中的函数链,但不确定如何在这种情况下应用它。