0

I have been searching for hours but yet cannot find a solution. I can't imagine that I am the first to come across this.

I have an Ajax form that calls a method in my controller, that returns a PartialView:

public PartialViewResult InventoryActivityAjax(int divisionId)
{
 // ajax call to get products
    return PartialView("_Index", builder.BuildIndexAjaxView(divisionId));
}

In this view is a link to another page. A lot of users click these links, and then press the Back button, and the page that gets re-loaded is the original page without the detail from the Ajax call.

Does anyone know how I can get the last page loaded? I would rather not recall the Ajax call either as it takes a second or so to load.

TIA, Mark

Mark
  • 77
  • 2
  • 10
  • With an AJAX call you do not change the browser's url location which is why the back button doesn't behave like you are expecting. To get around this people have turned to [Single Page Application](https://en.wikipedia.org/wiki/Single-page_application) frameworks. – Jasen Jan 04 '16 at 23:30
  • You could also attempt to do this manually with the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API). – Jasen Jan 04 '16 at 23:35
  • And see [here](http://stackoverflow.com/questions/163610/ajax-and-the-browser-back-button) and all of its linked questions. – Jasen Jan 04 '16 at 23:40

0 Answers0