Untitled
unknown
plain_text
a year ago
1.0 kB
4
Indexable
index.html: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content=""IE=edge"> <meta name="vieport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <div id="wrapper"> <div>Ajax Functionality</div> <div> <button onclick="loadMessage()">Change Content</button> </div> </div> <script> function loadMessage(){ let xhr = new XMLHttpRequest(); xhr.open('GET','./message.txt',true); xhr.onload=function(){ document.getElementById('wrapper').innerHTML = this.responseText; }; xhr.send(); } </script> </body> </html> message.txt: <h1>Welcome to Ajax Programming</h1> <p>Ajax is a set of web development techniques that uses various web technologies on the client-side to create asynchronous web applications. With Ajax, web applications can send and retrieve data from a server asynchronously (in the background) without interfering with the display and behaviour of the existing page. </p>
Editor is loading...
Leave a Comment