javascript - How can i get external HTML with JS or jQuery -


this question has answer here:

i trying html of external url jquery cannot code below work.

can 1 tell me how make work?

<script language="javascript" type="text/javascript"> $.ajax({     url: 'http://news.bbc.co.uk',     type: 'get',     success: function(res) {         var headline = $(res.responsetext).find('a.tsh').text();         alert(headline);     } }); </script> 

crossbrowser access not allowed in ajax


you use jsonp has limitation

another solution create iframe , change url website want. when iframe loads innnerhtml of iframe , should provide result

<iframe id="urldetails" onload = "htmlcontent()" src=""></iframe>  $("#urldetails").attr("src","http://news.bbc.co.uk");  function htmlcontent() {  var urlinnercontent = $("#urldetails").html(); } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -