I am using Jquery to load a page’s html and then select specific parts of it. But for some reason this does not work on the site I want to use it for (#1). Using firebug I can see that it does not receive an answer containing the html of the page. Can anyone explain why it does not work?
<head>
<script class="jsbin" src="jquery.min.js"></script>
<script type="text/javascript" src="jquery.xdomainajax.js"></script>
<script type="text/javascript">
$(document).ready(
function(){
$('#1').load("http://ted.europa.eu/udl?uri=TED:NOTICE:310574-2011:TEXT:EN:HTML p");
$('#2').load("http://www.google.com a");
}
);
</script>
</head>
<body>
<p id="1"></p>
<p id="2"></p>
</body>
The answer on the request showing no result:
jsonp1319995924645({"query":{"count":"0","created":"2011-10-30T17:32:10Z","lang":"en-US"},"results":[]});
Due to browser security restrictions, most “Ajax” requests are subject to the same origin policy; the request can not successfully retrieve data from a different domain, subdomain, or protocol.
Use any jQuery AJAX function and set
dataType: "jsonp"