I have a asp.net MVC view. A button click on this view should redirect the user to another view. The second view is built with few partial views. One of the partial view is taking long time to load, so i don't want this overhead on the page load and i want that partial view to run on ajax call, so that it can run asynchronously. But on redirect, I want to return the second view with other partial views. Please suggest a workaround for this.
$(document).on('click', '#buttonClick', function () {
window.location = '/some/someAction?id=123';
$.ajax ({
type: 'GET',
url: '/some/LoadPartialView?id=123',
success: function(data){
$('#timeTakingPartialView').html(data);
}
});
});
Window.location is redirecting to second view after the ajax call. So reload is stepping over the ajax call.