2015-10-16 63 views
0
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 
+0

點擊鏈接不應該等待AJAX​​調用完成。你能展示代碼來證明這種行爲嗎? – David

回答

0

你能不能讓你的鏈接客戶端,而不是通過重定向在後面的代碼鏈接的?

鏈接到其他網頁

+0

是的,我已經在javascript代碼中使用了window.location.href,並且使用了相同的結果 –