When i load a partial view with this jquery :
$.get('@Url.Action( "List" , "Menu" )', function(data) {
$('#treeviewdiv div').replaceWith(data);
});
All sites load again inside my site. i mean another head tag, another body tag.
I use this and its not working too:
$.get('@Url.Action( "List" , "Menu" ) #container', function(data) {
$('#treeviewdiv div').replaceWith(data);
});
…and container is a div tag inside my partial view.
How can i fix it?
This is usually indicative of the action returning a full view and not a partial view. Good news is this can be solved simply with a few different options.
1 Make the action return a partial view:
2 If this is an action that could be called via ajax or standard methods, it may be helpful to toggle based on an ajax request:
3 Another option is to let the view handle it for you (You can do this on the specific view or in the
ViewStart.cshtmlfile):