ASP.NET MVC + jQuery BlockUI – AJAX HttpReqest + Page Loading Handling
// : Load the jQuery Library & the jQuery BlockUI Library // < input id="SaveBtn" type="button" value="Save" style="font-weight:bold;" /> < div id="LoadingPanel" style="display:none; line-height:50px;">** Page Loading **< /div> < div id="ResultPanel">< /div> |
$(document).ready(function () { $("#SaveBtn").click(function () { PostObj(); }); }); function PostObj() { $("#ResultPanel").empty(); $.blockUI({ message: $("#LoadingPanel") }); $.ajax({ url: "@(Url.Action("Player", "JSON"))", type: "POST", dataType: "json", success: function (data) { console.log(data); $("#ResultPanel").html(JSON.stringify(data)); setTimeout($.unblockUI, 1500); } }); } |