Just started to learn ajax and completely confused (
She seems to have found a good example - http://uroki-javascript.ru/tryit.php?filename=tryajax_get_unique
Guys, tell me, please, because in addition to this code there must be some kind of code on the servlet?
<![CDATA[ <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { var xmlhttp; if (window.XMLHttpRequest) {// код для IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// код для IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","demo_get.php?t=" + Math.random(),true); xmlhttp.send(); } </script> </head> <body> <h2>AJAX</h2> <button type="button" onclick="loadXMLDoc()">Запросить дату</button> <p>Кликните кнопку несколько раз, чтобы увидеть, изменяется ли время или возвращается кэшированный файл (в этом случае время будет одно и то же).</p> <div id="myDiv"></div> </body> </html> ]]>