Is it possible to force update of some values of my View even when I use window.history.back()
of Javascript? My example:
In my layout, I have a cart icon with the number of items inside it. When I add an item to the cart with this code:
function AddCartItem(obj) {
obj.SelectedResolutionID = $('input[name=ImageResolutionID]:checked').val();
$.ajax({
method: "POST",
url: "/Ajax/AddCart",
data: JSON.stringify(obj),
contentType: "application/json; charset=utf-8",
dataType: "json"
})
.done(function (obj) {
if (obj.response) {
setTimeout(function () { window.history.back() }, 500);
}
});
}
and return to the previous page using window.history.back()
as written in the code above. However, this command possibly recovers from the cache the previous page, and the icon with the number of items does not update! is it possible for me to force this update and keep the command window.history.back()
?
I use ASP.NET MVC5, the number of items in my cart comes from a cookie control class, follow the code:
<li>@CartCookieController.ReturnCartProductsCount()</li>