I'm using asp.net-mvc and as far as I know the OnLoad event would work if I put it in body, which is in ~ Layout, but I need this alert to be displayed on a single page, because if I put in body it will run all instead ... how can I do it?
View code:
@model Tribus.Models.Pagamento
@{
var Id = Session["PacoteID"];
}
<script type="text/javascript">
$(document).ready(function () {
//window.onload = window.alert("entrou aqui");
window.onload = function () {
var id = $(this).attr(Id);//id do item
window.alert(id);
var url = '@Url.Action("RetornoRegistrar", "Pagamento")';
$.post(url, { id: id },
function (data) {
window.alert("Registrado com Sucesso\nLogo seu produto será liberado.")
});
});
});
</script>