更新收件箱新邮件数 [英] updating inbox new message count

查看:72
本文介绍了更新收件箱新邮件数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的一个项目,我需要创建一种内部电子邮件系统.在页面顶部的导航菜单中,我有一个指向收件箱的链接,该链接还包含未读邮件的数量.

For one of my projects I needed to create a sort of internal email system. In my navigation menu at the top of the page I have a link to the inbox and that link also has the number of unread message.

当前,如果您收到新消息,则在刷新页面之前不会更新导航中的未读消息计数.需要更改为,使其每隔几秒钟更新一次.

Currently if you receive a new message the unread message count in the navigation isn't updated until the page is refreshed. This needs to change to so that it updates every few seconds on its own.

我不想使用预制的东西,我想自己创建解决方案,但我只需要向正确的方向推即可.

I don't want to use something premade, I want to create the solution myself but I just need a push in the right direction.

我应该结合使用ajax和Web服务吗?还有别的吗谢谢!

Should I use some sort of combination of ajax and webservices? Something else? thanks!

推荐答案

是的,您需要结合使用ajax和Web服务.创建一个每隔几秒钟触发一次并到达Web服务端点的ajax方法,该端点返回收件箱中未读消息的数量.然后让ajax返回方法使用服务器的结果更新未读消息计数.

Yes, you'll need to use a combination of ajax and web services. Make an ajax method that fires off every few seconds and hits a web service endpoint which returns the number of unread messages in the inbox. Then have the ajax return method update the undread message count with the result from the server.

这篇关于更新收件箱新邮件数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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