I'm working on a personal home-page.html, so it resides on my computer and it is accesible only from my browser. Now for example I want get all element <a>
from an external page and put them into a <div>
when I click a button. Is it possible using a javascript funtion or jquery ?
I have found answers about different domains, but it is not my case. I want to make something like this:
https://jsoup.org/
and
https://try.jsoup.org/~LGB7rk_atM2roavV0d-czMt3J_g
.
I tried with <frame>
or load()
but with bad results...
I'm trying this:
<button id="button">Click me</button>
<div id="txt"></div>
<script type="text/javascript">
$("#button").click(function(){
$.ajax({
url:"http://cnt.rm.ingv.it",
type:'GET',
success: function(data){
$('#txt').html($(data).find('a').html());
}
});
});
</script>
<style type="text/css">
#txt{
width: 400px;
height: 400px;
}
#button{}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>