我正在開發一個打印頁面,其中我們必須顯示所有的報告圖。多個ajax調用jquery mvc
每個客戶的圖表數量是不同的。 所以,我爲每個可用的圖形寫jQuery腳本如下:
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"); }
}
的問題,數據是沒有任何問題的,從控制器返回,但是當我在分配給jqplot數據正在成爲空。我認爲這是由於異步ajax調用。我嘗試使用async:false和timeout,但仍然面臨問題。
有什麼辦法可以處理嗎?
在此先感謝...
任何想法請? – mmssaann
檢查這是否有幫助http://stackoverflow.com/questions/10877438/jqplot-chart-using-asp-net-mvc-json – ali