I have a asp.net webform page who uses 2 google charts, I'm using Jquery Ajax to retrieve information from database to populate the charts, the query to retrieve the chart data takes a long time, in this time user can make a click in a link to redirect to another page, the redirect is very slow because wait querys return from database to do the redirect, how can I avoid this behavior?
I'm using Jquery Datatable plugin, when user click one row an javascript event is called
功能redirectToCampaignCreator(CAMPAIGNID){ 嘗試{$ .xhrPool.abortAll(); redirecting = true; $('#multiCampID')。val(campaignID); //window.location.href =「campaigncreator.aspx?Edit = True & CampaignId =」+ campaignID; DoPartialPostBack(「<%= btnCampaignEdit.UniqueID%>」); }趕上(E){} } ASP.Net代碼後面等待ADO.Net查詢數據庫返回重定向
In this function I cancel the Ajax calls and do a __doPostBack(control, ""); to ejecute some code to save session values and then redirect
protected void Page_PreInit(object sender, Even`enter code here`tArgs e) { if (IsPostBack) { if (Request.Form["multiCampID"] != null) { View(); Context.Response.Redirect("CampaignCreator.aspx?Edit=True", true); } } }
The redirect is slow because it's waiting querys return from DB
點擊鏈接不應該等待AJAX調用完成。你能展示代碼來證明這種行爲嗎? – David