I am trying to reload a previous page with data from the server when the user clicks on the back button. I am using the Window Before Unload method. The Ajax call is supposed to invoke the Controller and get me the values from the server but it is not firing.
Any help will be much appreciated.
$(function() {
$(window).bind('beforeunload', function() {
$.ajax({
url: "/test/searchUrl",
type: "GET",
cache: false,
datatype: "text",
success: function (result) {
alert('HI Ajax Call SUCCESS' + result);
}
});
return;
};
});