I need to invoke the session closing method from JavaScript (once the system counter reaches 0). Sight code:
<asp:LinkButton
ID="Lbtn_Salir"
type="button"
runat="server"
OnClick="Lbtn_Salir_Click"
OnClientClick="Lbtn_Salir_Click">
Salir
</asp:LinkButton>
The code associated with that view:
public void os(string value, object target)
{
Session[value] = target;
}
protected void Lbtn_Salir_Click(object sender, EventArgs e)
{
os("ID_USER", null);
os("MENU", null);
Response.Redirect("~/Login.aspx", false);
}
When the button is pressed by the user, the session variables are destroyed correctly and the application sends it to the home page. What I want is to reuse that function from a script, however nothing happens once I invoke the click event associated with the Exit button.
function salir(){
// Reloj llega a 0
// Método 1
var btn_salir = $("#Lbtn_Salir");
btn_salir.click();
// Método 2
$('#btn_salir').trigger('click');
}