문제

I have a web development using ASP.NET MVC 4 in progress, using the Web framework KendoUI that need use a Ajax Loader on time to order another "VIEW" on system. Ajax Loader will runs in the request "VIEW" with delay of request actions on system. So the user will know that clicking on an item there is a procedure to request the action, and not need multiple clicks on the screen. I need a direction to take. Thanks.

도움이 되었습니까?

해결책

I choose to do it this way, this will cover for all Ajax actions on my site.

HTML

<div id="GlobalMsg">
    <img src="~/loading.gif" /></div>

CSS

#GlobalMsg {
    /*padding: 25%;*/
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: 999999 !important;
    display: block;
    position: fixed;
    top: 0px;
    left: 0px;
}

jQuery

$('#GlobalMsg')
            .hide()
            .ajaxStart(function () {
                $(this).show();
               // Any other handling
            })
            .ajaxStop(function () {
                $(this).hide();
                // Any other handling
            }).ajaxError(function (event, jqxhr, settings, exception) {
                // Any other handling
            });
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top