Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$.get not returning html [closed]

My Simple code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script src="jquery.js"></script>
<script type="text/javascript">
$(function(){
$.get("http://www.facebook.com",function(data){
alert(data);});

});</script></head>

 <body>
</body>
</html>

It should alert the facebook content but it is not doing so

UPDATE

Now iam using php

<?php
 $str=file_get_contents("http://www.facebook.com");
    echo strip_tags(htmlspecialchars($str)); 
?>

Why it is not removing tags?


1 Answers

If youre using php on the serverside. You could create a service that returns the html using:

$html = file_get_contents('http://www.facebook.com');

ASP.NET:

using(WebClient client = new WebClient()) 
{
    string html = client.DownloadString("http://www.facebook.com'");
}
like image 175
Johan Avatar answered Jul 06 '26 01:07

Johan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!