I have a remote file that contains a javascript code that needs to be executed, I'm interested to get its result from another page (that is on a different domain).
Remote Page :
<script>
var height = somevalue that I get using a lot of calculations that can be done only from that remote page;
document.write(height);
</script>
My Page :
<script>
jQuery.ajax({
type: "GET",
url: RemotePage,
success: function(msg){
alert(msg);
}
});
</script>
Expected Result :
Height Value
Result :
<script>
var height = somevalue that I get using a lot of calculations that can be done only from that remote page;
document.write(height);
</script>
Clearly here the code is returned back and not executed, anyway to have the javascript executed, and then have the result returned? I have already tried setting the dataType : script
on the AJAX settings, however this only takes the code and executes it on the current page, which results in an undefined result. Any way to achieve this goal?