I tried to include another js file in jquery. I have found this exmaple code and tried, but browser console give me this error.
CODE
$.getScript( "js/balloon.js", function( data, textStatus, jqxhr ) {
console.log( data ); // Data returned
console.log( textStatus ); // Success
console.log( jqxhr.status ); // 200
console.log( "Load was performed." );
});
ERROR
XMLHttpRequest cannot load file:///C:/EDIT/swf/js/balloon.js?_=1420941386739. Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https, chrome-extension-resource.
What mistake I have made, can anyone tell me ? Thanks.
If there is another good example to include js file in js please suggest for me. Thanks again.
UPDATED
I also tried the code bellow but it included before the js included in html, any suggestion to make it included together ?
var script = document.createElement('script');
script.src = "js/balloon.js";
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);