Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head><title>Simple Ajax</title>
- <script type="text/javascript">
- function ajaxFunction() {
- var xmlHttp;
- var p = document.getElementById("id1");
- try { // Firefox, Opera 8.0+, Safari
- xmlHttp = new XMLHttpRequest();
- } catch (e) { // Internet Explorer
- try {
- xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
- } catch (e) {
- try {
- xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
- } catch (e) {
- alert("Your browser does not support AJAX!");
- return false;
- }
- }
- }
- xmlHttp.onreadystatechange = function () {
- if (xmlHttp.readyState == 4) {
- p.innerHTML = xmlHttp.responseText;
- }
- }
- xmlHttp.open("GET", "txt.txt", true);
- xmlHttp.send(null);
- }
- </script>
- </head>
- <body>
- <div><input type="button" value="Zmień tekst" onclick="ajaxFunction()";" /></div>
- <p id = "id1">Ten tekst zostanie zmieniony przez AJAX !</p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement