AJAX

From Ilianko
Revision as of 12:08, 17 June 2011 by Anko (talk | contribs) (Created page with "Смяна на текст, с текст от даден файл. IE7+ <code><pre> <script type="text/javascript"> function loadXMLDoc() { xmlhttp=new XMLHttpRequest();...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Смяна на текст, с текст от даден файл. IE7+

<script type="text/javascript">
  function loadXMLDoc()
  {
    xmlhttp=new XMLHttpRequest();
    xmlhttp.onreadystatechange=function()
    {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
      {
        document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
      }
    }
    xmlhttp.open("GET","ajax_info.txt",true);
    xmlhttp.send();
  }
</script>
</head>

<div id="myDiv"><h2>Let AJAX change this text</h2></div>
<button type="button" onclick="loadXMLDoc('')">Change Content</button>