I would like to achieve that when clicking in an image, in the div where this image is, a div with other content from another .html is loaded, but I can’t get it done.
If I do, the following, it works perfectly:
$('#windows_link').click(function(){
$('#apps_container').html("Hi!");
});
But if I do the following, it does not work; it doesn’t do anything actually:
$('#windows_link').click(function(){
$('#apps_container').load('windows_apps.html #apps_container');
});
Any help, please?
Thanks a lot in advance!
When you’re local any other HTML path is treated as another domain in certain browsers (Chrome is on the list). That means any AJAX request (what
.load()does underneath) you attempt will be blocked by the same origin policy.What you have will likely work fine…just not locally, in Chrome.
You can verify this by testing in another browser like Firefox, or by launching chrome with a command line switch to disable this safety feature (only for testing!, turn it off after):