trouble with jquery load method -


i have table in 1 html file , div in , both files on same server, same folder. i'm trying use jquery load function folowing. :

$('#div').load('game.html #tbl', function(){ alert ("succes on load");}); 

as can see try target #tbl id of table, , alert succes, no tables loaded. can tables loaded way?

look in browser console, have error there. you've got make sure have proper path, relative path. if current doesn't work, try messing around. add ../ before path , see if works. don't know file structure easier you.

another problem could don't have right permissions on file, 403 forbidden. so, go check web browser's console.

if have following file structure , run code beneath that, 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 file</h1></div> 

edit: after messing around bit found solution. can't run scripts .load opening .html file hard drive. need install wamp/lamp/mamp (a local server) can access entering localhost in browser.

wamp

mamp

please have here: angularjs error: cross origin requests supported protocol schemes: http, data, chrome-extension, https


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -