I have the following functions on my page, when I call them via javascript, they work perfectly:
function msgSucesso(msg) {
toastr.success(msg);
}
function msgErro(msg) {
toastr.error(msg);
}
So, I have a button on my aspx page that calls an event from the server:
<asp:Button ID="btnSalvar" runat="server" OnClick="btnSalvar_Click" Text="Salvar" />
No cobehind:
protected void btnSalvar_Click(object sender, EventArgs e)
{
try
{
// código para salvar
}
catch (Exception ex)
{
// erro
}
}
I would like to call the functions msgSucesso
or msgErro
when everything works out or when it fails, respectively, when running the server event. How to do this? I know it's easy, but I'm used to ASP.NET MVC which is quite different.