Spent 3 hours reading reference, but still no effect, so asking here.
OS: Windows 7 (is it relevant?)
Browser: Opera 11.51
jQuery: 1.6.2
Two files on a local machine, main.html and menu.html in the same folder.
main.html:
<html>
<head>
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
// append contents
$('#menu').load('menu.html');
});
</script>
</head>
<body>
<table>
<tr>
<td id="menu"></td>
</tr>
</table>
</body>
</html>
menu.html:
<html>
<head></head>
<body>
menu tree
</body>
</html>
As I guess, when I open main.html, there should be one table with one cell containing “menu tree” string. And it works, for example, in IE. But Opera doesn’t show any result.
I debugged the stuff with optional callback for load(), it shows that result status for load() is “error”.
What am I doing wrong?
In Opera you must set the flag Allow File XMLHttpRequest (opera:cofig – User Prefs).
In Google Chrome you must use option parameter –allow-file-access-from-files for run browser, for example: “C:\Documents and Settings\User\Local Settings\Application Data\Google\Chrome\Application\chrome.exe” –allow-file-access-from-files