i want to call a webpage from jQuery and add the content to it to a div.
The downloaded data should not undergo any parsing, it should be in raw format.
I try to integrate the another application to my website.
I’ve done some experimenting and the code does a successful request, but
there seems there is no result displayed properly.
<html>
<head>
</head>
<h1>Whisper</h1>
<div id="result"></div>
<h3>Output</h3>
<div id="output"></div>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="jquery.cookie.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$.ajax({
type: "GET",
// dataType: "script",
url: 'http://somesite.com/ajax/chat.php?&test=1&l=1&tt=1',
//data: "",
beforeSend: function(){
// alert( "sending " );
},
error: function( request,error ){
alert("error: " + error + " " + request );
},
success: function(data, textStatus, XMLHttpRequest) {
$("#output").html( "output: " + data + "." );
$("#result").html( "ok " + data +" "+ textStatus +" "+ XMLHttpRequest);
return false;
}
});
});
</script>
</html>
Since the output will not be HTML, it should be displayed without processing.
You’re trying to access a resource on a remote domain with an XmlHttpRequest, which is by default blocked for security reasons by the Same Origin Policy. You are indeed making the request, but your response will be
null…that’s what the SOP does, it’s a rule the browser follows blocking any content from reaching your JavaScript.There are 2 options here:
<script>element and does a GET…which can only execute JavaScript). I’m no expert on the facebook API, I’m not sure if what you’re after is even available this way.