The jquery load in the below code doesn’t work. What I’m missing here?
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"> </script>
</head>
<body style="font-size:62.5%;">
<div id="dialog" title="Dialog Title">I'm in a dialog</div>
<script>
$(document).ready(function() {
$("#dialog").load('http://www.google.com/intl/en/about/index.html #maia-main');
});
</script>
</body>
</html>
You are requesting a page that is on a different domain so Cross-Domain-Policies apply. You can only access data cross-domain if the remote-server allows it (and only using JSONP I believe, anyone please correct me if I’m wrong on this). If you want to grab the source of a Google page, you will need to do it with a server-side script as a proxy for your jQuery:
And in
my-script.phpyou would grab the remote page you want:Docs for
file_get_contents(): http://www.php.net/file_get_contents