如何在 MVC 视图之间显示“加载" [英] How to show 'loading' between MVC Views

查看:18
本文介绍了如何在 MVC 视图之间显示“加载"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个视图,其中包含一个由 jquery 生成的充满数据的表.在该表中,其中一列具有到另一个视图(完全独立的控制器)的链接(标准 ).单击此链接经常会导致加载时间过长,因为正在加载的视图可能会在将其结果显示到屏幕上之前需要处理大量数据.

I have a view with a jquery-generated table full of data. In that table, one of the columns has a link (standard <a href="">) to another View (entirely separate controller). Clicking this link can, frequently, cause a long load time, as the View that is loading potentially has a massive amount of data to churn through before spewing its results onto the screen.

有没有办法在点击其中一个链接时获得加载微调器",直到新屏幕加载?

Is there a way, upon clicking one of those links, to get a 'loading spinner' until the new screen loads?

同样,这是一个视图中的标准超链接 (href),它链接到一个完全独立的视图、独立的控制器.

Again, this is a standard hyperlink (href) in a View that links to a completely separate View, separate controller.

推荐答案

这里是我的一个网站的示例,其中有一个提交按钮,并且只是在单击时阻止 UI.下图显示了用户看到的内容.收集数据后,将加载并显示新页面.

Here is a sample from one of my sites with a submit button and simply blocking the UI on click. The image below shows what the user then sees. After the data is gathered the new page is then loaded and presented.

<input type="submit" value="Search" name="searchparty">

<script>
//submit search, display loading message
    $('input[type = submit]').click(function(){
        $.blockUI({ css: { 
            border: 'none', 
            padding: '15px', 
            backgroundColor: '#000',
            opacity: .6
        } }); 
    });
</script>

这篇关于如何在 MVC 视图之间显示“加载"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆