Look in the browser console, you probably have an error there. You've got to make sure you have the proper path, this is a relative path. If your current doesn't work, try messing around. Add ../
before the path and see if that works. I don't know your file structure so this is probably easier for you.
Another problem could be that you don't have the right permissions on that file, 403 Forbidden
. So, go check your web browser's console.
If you have the following file structure and run the code beneath that, everything should work fine.
/project_name
├── index.html
├── game.html
index.html
<div id="div"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>$('#div').load('game.html #tbl', function(){ alert ("succes on load");});</script>
game.html
<div id="tbl"><h1>I origin from another file</h1></div>
EDIT: After messing around a bit I found the solution. You can't run scripts with .load
just by opening a .html file from your hard drive. You need to install WAMP/LAMP/MAMP (a local server) that you can access by entering localhost
in the browser.
WAMP
MAMP
Please have a look here: AngularJS Error: Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https
and couple of- it works
– nhrnjic6 Jun 25 '15 at 13:01