Want to set 'src' of script to my IP.
- by Ozaki
I have a script that links to the server I am hosting (IP can change) usually I would just use for links:
var url ='http://' + window.location.hostname + 'end of url';
But in this case it isnt appearing to be so easy.
I have tried: (1)
$('#scriptid').attr('src', url);
as well as: (2)
var script = document.createElement( 'script' );
script.type = 'text/javascript';
script.src = url;
$("#insert").append( script );
Now case (2) works loads the script runs the script. But when at the end of my script it hits the 'write data' it decides to replace the entire page with just the data.
Any idea on how I can do this?