Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>teste ajax</title>
- </head>
- <body>
- <div id="resposta">
- </div>
- <script
- src="https://code.jquery.com/jquery-3.3.1.js"
- integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
- crossorigin="anonymous"></script>
- <script >
- $(document).ready( function(){
- $.get( "teste.txt" , function(dados, status, xhr) {
- $("#resposta").text(dados);
- } );
- } );
- </script>
- </script>
- </body>
- </html>
- <!DOCTYPE html>
- <html>
- <head>
- <title>teste ajax</title>
- </head>
- <body>
- <div id="resposta">
- </div>
- <script>
- var resposta = document.getElementById("resposta");
- var xmlHttp;
- if (window.XMLHttpRequest) {
- xmlHttp = new XMLHttpRequest;
- }
- else {
- xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlHttp.onreadystatechange = function(){
- if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
- resposta.innerHTML = xmlHttp.responseText;
- }
- }
- xmlHttp.open('GET', 'teste.txt', true);
- xmlHttp.send();
- </script>
- </script>
- </body>
- </html>
- test
- test123
Add Comment
Please, Sign In to add comment