Reputation: 60
I have this code:
$('#example').load(window.location.pathname+'#example');
after ajax call in success, but it is loading whole page in a div.
Any help would be appreciated.
Upvotes: 0
Views: 4681
Reputation: 1149
The code to load the div is fine.
You need to look into the content returned by url. It seem window.location.pathname+'#example'
returns the whole page.
Upvotes: -1
Reputation: 30099
Try adding a space:
$('#example').load(window.location.pathname+' #example');
According to the documentation example, there should be a space before the selector:
http://api.jquery.com/load/#loading-page-fragments
Upvotes: 5