Reputation: 193
I'm not sure why suddenly it's not loading content from other html document.
$('a').on('click', function(e){
e.preventDefault();
$.get('page1.html', function(data){
var content = $('#result', data).html();
console.log(content);
});
});
<a href="#">Load Page</a>
It was loading the content inside the div called #result in page1.html before, I don't know what I have changed but it's not working now.
console.log
XMLHttpRequest cannot load file:///I:/page1.html. Received an invalid response. Origin 'null' is therefore not allowed access.
Upvotes: 0
Views: 43
Reputation: 686
It seems in your console log that you are not using a server and for security reasons javascript(XMLHttpRequest) is not allowed to access local files of your computer
Here I:/page1.html
is local filesystem address
That's why file is not being loaded.
Upvotes: 1