Reputation: 85
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#s").load("http://www.universalis.com/mass.htm");
});
</script>
</head>
<body>
<div id="s"></div>
</body>
</html>
div is not loading link , it is showing blank page . Is there any other way to load external link except iframe?
Upvotes: 1
Views: 419
Reputation: 85
To load external link in ".load()"
create page say external.php
In external.php put following code:
<?php
$url = 'http://ur/url/here';
echo $var = get_file_contents($url); ?>
now load this page in jquery n it will load external link
$('div').load('external.php');
Upvotes: 0
Reputation: 6834
Question1: .load() not working with external link
Answer1: This is possible when both pages are on the same server.
You should take a look at jQuery's .load()
function: http://api.jquery.com/load/
Question2: Is there any other way to load external link except iframe?
Answer2: Yes this is possible you can use object tag. Fiddle
good luck!
Upvotes: 1
Reputation: 12039
Try by using this.
$("#s").html('<object data="http://www.universalis.com/mass.htm">');
It works fine.
Upvotes: 0