Reputation: 395
I'm trying to load a video stream provided by a 3rd party into my site. The file linking to the stream is provided as a js file and simply writes out document.write('iframe code...')
. As the stream is domain protected so the js file has to be referenced.
This lead me to the $.ajax
/ dataType: script
and $.getScript
options. The following leaves the target div blank
$.ajaxSetup ({
cache: false
});
var stream = 'http://live.streamsupplier.com/se8ilyjs/';
$("#cam").click(function(){
$.ajax({
url: stream,
dataType: "script",
success: function(data) {
$('#cam').html(data);
alert('Load was performed.');
}
});
});
Any ideas would be most welcome.
Upvotes: 0
Views: 521
Reputation: 337627
You are falling foul of the Same Origin Policy because the URL your are requesting is external from your site. You will need to use a server-side proxy to get the script, and then call this local URL from your jQuery code to insert the script.
Upvotes: 1