Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I was able to create a testing code. in FF and chrome seems to work fine (1 submit) but the IE9 (and compatibility version) seems to hit 1, 2 or 3 times. NOTE: the submit() cause the postback. CASE 1. delay in Javascript Page:</p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;testing&lt;/title&gt; &lt;script type="text/javascript"&gt; function submitForm() { document.forms[0].submit(); alert("delay"); document.forms[0].submit(); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" name="form1" runat="server"&gt; &lt;div&gt; &lt;asp:TextBox ID="TextBox1" runat="server" Width="220px"&gt;&lt;/asp:TextBox&gt; &lt;button onclick="submitForm(this)"&gt;CLICK&lt;/button&gt; &lt;br /&gt; &lt;asp:Label ID="Label1" runat="server"&gt;&lt;/asp:Label&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Code behind:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if(IsPostBack) { incrementVal(); } } private void incrementVal() { var val = (int)(Session["val_" + TextBox1.Text] ?? 0); val++; Label1.Text += TextBox1.Text + ": " + val.ToString("00") + " - " + DateTime.Now.ToLongTimeString() + "&lt;br/&gt;"; Session["val_" + TextBox1.Text] = val; } </code></pre> <p><img src="https://i.stack.imgur.com/IATyI.png" alt="enter image description here"></p> <p>CASE 2: Slow Response</p> <p>remove JS Alert:</p> <pre><code>function submitForm() { document.forms[0].submit(); document.forms[0].submit(); } </code></pre> <p>add delay in the server side:</p> <pre><code>if(IsPostBack) { incrementVal(); Thread.Sleep(500); } </code></pre>
 

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