Difference between revisions of "AJAX"

From Ilianko
(Created page with "Смяна на текст, с текст от даден файл. IE7+ <code><pre> <script type="text/javascript"> function loadXMLDoc() { xmlhttp=new XMLHttpRequest();...")
 
(No difference)

Latest revision as of 12:08, 17 June 2011

Смяна на текст, с текст от даден файл. 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>