Note that there are some explanatory texts on larger screens.

plurals
  1. POClick event not fireing when page is inactive for some time
    primarykey
    data
    text
    <p>Ok, this is my problem :). I have couple of [WebMethods] in my code behind and using jquery ajax to get data from server. And then it happens :). After some time while page is inactive when i try to click on button which should have send request to server it simply does nothing for about half of minute and only then event is fired and i get response from server.</p> <p>my javascript looks something like this:</p> <pre><code>addToCart.click(function () { AddOrRemoveItemToCart($(this)); }); function AddOrRemoveItemToCart(control) { var itemId = contol.attr("id"); $('document').ready(function () { $.ajax({ type: "POST", url: "Home.aspx/AddOrRemoveItemToCart", data: "{itemId:" + itemId + "}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { if (data.d.length &gt; 0) { SucessAddItemToCart(data.d); } }, error: function (textStatus) { alert(textStatus); } }); }); } function SucessAddItemToCart(data) { //DO SOMETHING WITH DATA } </code></pre> <p>And my server side code look something like:</p> <pre><code>[WebMethod] public static List&lt;CartItem&gt; AddOrRemoveItemToCart(string itemId) { List&lt;CartItem&gt; items = new List&lt;CartItem&gt;(); List&lt;CartItem&gt;temp = new List&lt;CartItem&gt;(); bool check = false; if(HttpContext.Current.Session["items"]!=null) { items = (List&lt;CartItem&gt;)HttpContext.Current.Session["items"]; foreach(CartItem c in items) { if(c.Id != itemId) temp.Add(c); else check = true; } if(!check) temp.Add(new CartItem{Id = itemId}); } HttpContext.Current.Session["items"]=temp; return temp; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload