I am developing a print page in which we have to show all the reports graphs.
The number of graphs for every customer are different. So, I am writing jquery script for each available graph as follows:
buildJQs: function () {
$(".emailgraphs").each(function () {
YAHOO.Report.Print("Email", $(this).attr("responsefield"), $(this).attr("id"), $(this).attr("metricid"))
});
},
Print: function (name, graphid, divid, metricid) {
try {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: m_oReport.ds,
async: false,
timeout: 300,
data: JSON.stringify(m_oReport.printp(name, graphid, metricid)),
beforeSend: function () {
//Displays loading image before request send, till we get response.
//$("#" + divId).addClass("loading");
},
cache: false,
success: function (data) {
// if they define a success function (s), call it and return data to it.
if (typeof m_oReport.prints === "function") {
//$("#" + divId).removeClass("loading");
m_oReport.prints(data, divid, name, metricid)
}
},
error: function (err) {
$("#" + divid).html(err);
}
});
}
catch (err) { alert("catch"); }
}
The problem, data is returned without any issues from controller but while I am assigning it to jqplot the data is becoming empty. I think this is due to that asynchronous ajax calls. I tried with async: false and timeout but still facing the issue.
Is there any way to handle this??
Thanks in advance...