// https://www.aspsnippets.com/Articles/ASPNet-MVC-Master-Detail-example-Display-details-of-Grid-Row-inside-Popup-using-jQuery.aspx $(function () { $("[id^='detalhe-recibo']").on('shown.bs.collapse', function () { var _this = $(this); var link = $("a[data-target='#" + $(this).attr('id') + "']"); link.removeClass('glyphicon-plus'); link.addClass('glyphicon-minus'); if (!_this.attr('data-cache')) { var id = link.attr('data-recibo').substr(link.attr('data-recibo').lastIndexOf('-') + 1); $.ajax({ type: "GET", url: "/Recibos/Details/" + id, contentType: "application/json; charset=utf-8", dataType: "html", success: function (response) { _this.html(response); _this.attr('data-cache', true); }, failure: function (response) { _this.html("
Ocorreu um erro ao obter detalhes do recibo!
"); }, error: function (response) { _this.html("Ocorreu um erro ao obter detalhes do recibo!
"); } }); } }); $("[id^='detalhe-recibo']").on('hidden.bs.collapse', function () { var link = $("a[data-target='#" + $(this).attr('id') + "']"); link.removeClass('glyphicon-minus'); link.addClass('glyphicon-plus'); }); $("#year").on('change', function () { this.form.submit(); }); });