Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <div id="json"></div>
- <script>
- var xmlhttp = new XMLHttpRequest();
- xmlhttp.onreadystatechange = function() {
- if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
- var arr = JSON.parse(xmlhttp.responseText);
- for(var i = 0; i < arr.length; i++)
- document.getElementById("json").innerHTML += '<p>' + arr[i].sub + ' by '+ arr[i].teacher;
- }
- }
- xmlhttp.open("GET", "mySubjects.txt", true);
- xmlhttp.send();
- </script>
- <pre>
- [{"sub": "Advanced Inernet Technology","teacher": "Prof. Sanober"},
- {"sub": "Disrubuted Systems","teacher": "Prof. Bhushan"},
- {"sub": "Software Engg","teacher": "Prof. Madhuri"},
- {"sub": "Data Mining","teacher": "Prof. Shanti"}]
- </pre>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement