浏览器速度和QUOT ...之间QUOT权妥协;和"尊重模型" [英] The right compromise between "browser speed" and "respecting the model"

查看:110
本文介绍了浏览器速度和QUOT ...之间QUOT权妥协;和"尊重模型"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创造了过去几周谷歌地图API的应用MVC5。

I've been creating a Google Maps API MVC5 application for the past weeks.

我知道我应该把所有的逻辑控制器里面,但我有以下疑问:在我的主视图我有一个名为避免过路费按钮。由pressing该按钮的用户将看到的路线距离计算previously在控制器(具有和不具有过路费)。

I know that I should keep all the logic inside the controller, but I have the following doubt: In my main View I have a button called "Avoid tolls". By pressing that button the user will see the route distances calculated previously in the controller (both with and without tolls).

我的问题是:为什么我应该在控制器(XML服务)路线的距离,有和没有收费时,我能做到这一点的视图内仅当用户要检查路由距离无过路费?我觉得我失去的时间访问信息(XML服务),最有可能不会被用户的要求。

My question is: Why should I get the route's distances in the controller (xml service) with and without tolls when I could do that inside the View ONLY if the user wanted to check the route distance without tolls? I feel I'm loosing time accessing information (xml service) that most likely will not be demanded by the user.

或许有一种方法可以使视图返回到控制器的按钮是pressed的时间。是不是这样?

Perhaps there's a way to make the view go back to the controller by the time the button is pressed. Is that it?

感谢您!

推荐答案

您可以根据结果挂钩按钮高达在JavaScript Ajax请求,并从服务器请求额外的信息,然后更新您的看法。

you can hook the button upto an ajax request in javascript and request the additional info from the server then update your view based on the result.

这篇关于浏览器速度和QUOT ...之间QUOT权妥协;和"尊重模型"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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