Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <body>
- <div id="d1">
- <label for="inp1">Vnesi URL:</label><input type="text" id="inp1" style="width:350px;">
- <button onclick="getData();">Get Content</button>
- </div>
- <div id="d2"></div>
- <script>
- function getData() {
- var link;
- link=document.getElementById("inp1").value;
- var newlink=link.split("/");
- newlink=newlink[newlink.length-1];
- console.log(newlink);
- var link=document.getElementById("inp1").value;
- var xhttp=new XMLHttpRequest();
- xhttp.open("GET",newlink,true);
- xhttp.send();
- xhttp.onreadystatechange = function(){
- if(xhttp.readyState==4 && xhttp.status==200){
- document.getElementById("d2").innerHTML=xhttp.responseText;
- }
- }
- }
- </script>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement