Note that there are some explanatory texts on larger screens.

plurals
  1. POAjax show hide does not work in IE
    text
    copied!<p>What do I need to change to get the code to work in IE? In IE Saved message does not show/hide at all.</p> <p>This script autosaves input in MySQL. After successful save, it displays the message "Saved". It works in Firefox and Chrome:</p> <pre><code>&lt;script type="text/javascript"&gt; function init(){ window.setInterval(autoSave,15000); // 15000=15 seconds } function autoSave(){ var date_day1 = document.getElementById("date_day1").value; var amount1 = document.getElementById("amount1").value; var params = "date_day1="+date_day1+"&amp;amount1="+amount1; var http = getHTTPObject(); http.onreadystatechange = function(){ if(http.readyState==4 &amp;&amp; http.status==200){ msg = document.getElementById("msg"); msg.innerHTML = "Saved"; $('#msg').show(); } setTimeout(function () { $('#msg').fadeOut(function(){ $(this).hide(); }); }, 2000); }; http.open("POST", window.location.href, true); http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", params.length); http.setRequestHeader("Connection", "close"); http.send(params); } //cross-browser xmlHTTP getter function getHTTPObject() { var xmlhttp; /*@cc_on @if (@_jscript_version &gt;= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @else xmlhttp = false; @end @*/ if (!xmlhttp &amp;&amp; typeof XMLHttpRequest != 'undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp = false; } } return xmlhttp; } &lt;/script&gt; </code></pre> <p>HTML:</p> <pre><code>&lt;div id="msg"&gt;&lt;/div&gt; </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