How to know who called the screen

2

I have two List and Filter screens, both are redirected to a third screen called View

List View button List :

//ABRE TELA VISUALIZAR
$(document).on('click', '.visualizar', function(e) {
  e.preventDefault;
  var pClienteID = $(this).attr("data-id");
  window.location.href = "/Administrativo/Cliente/Visualizar?pClienteID=" + parseInt(pClienteID);
});
//FIM

Screen Preview button Filter :

//ABRE TELA VISUALIZAR
$(document).on('click', '.visualizar', function(e) {
  e.preventDefault;
  var pClienteID = $(this).attr("data-id");
  window.location.href = "/Administrativo/Cliente/Visualizar?pClienteID=" + parseInt(pClienteID);
});
//FIM

Doubt: How do I implement the Back button on the View screen?     

asked by anonymous 10.11.2016 / 23:38

2 answers

1

You can implement this button in two ways by creating the button and in the click event use:

window.location.href = '/Administrativo/Cliente/Listar'

To redirect to your action, or you can use history.go(-1) to return to previous page:

<input type="button" value="Back" onclick="history.go(-1);" />
    
11.11.2016 / 01:59
0

You can use this script

<script>
function goBack() {
    window.history.back()
}
</script>

and call it on your button

<input type="button" value="Back" onclick="goBack()">

Example:

function goBack() {
    window.history.back()
}
<input type="button" value="Voltar" onclick="goBack()">
    
11.11.2016 / 15:11