按钮点击事件触发时如何刷新页面 [英] how to refresh page when button click event fire

查看:729
本文介绍了按钮点击事件触发时如何刷新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



这里我想在第一页点击事件时刷新第二页。



例如。



如果我打开第二页而在另一台机器上有人在第一页点击事件。我想刷新我的第二页。另一个我只想刷新而不是重新定向到第二页。刷新。

hi to all,

Here i want to refresh second page when click event occur in first page.

For eg.

If i open second page and in another machine somebody fire click event in first page.just i want to refresh my second page. and another one i just want to refresh only not to redirect first to second page.while refreshing.

推荐答案

1。在第二页上放置ajax脚本面板,更新面板,ajax计时器。



2.编写你的功能并打电话给计时器。



3.创建一个用于在这些页面之间共享数据的Web服务。



4.当您点击第一页按钮时,数据将被转移到第二页的Web服务和ajax计时器调用Web服务并显示第一页活动信息。



5.这只是在多个页面之间共享一个对象。 br />


6.可以使用Application变量代表Web服务来完成。
1. put ajax script panel, update panel, ajax timer on second page.

2. write your function and call on timer.

3. create a web service for sharing data between these pages.

4. when you click on button of first page then data will be transfer to web service and ajax timer of second page call the web service and display first page activity information.

5. this is just to share an object between multiple pages.

6. It can be done using Application variable in behalf of web service.


首先你必须记录你的变化第二个网页已经完成。您还可以设置一个指示更改的标志。

在您的第一个网页中,您必须轮询Web服务器以检查第二页中的任何更改。基本上只是检查国旗。如果有变化,获取更改的值(JSON名称 - 值对将很棒)并更新您的第二页。



这是一个非常天真的实现,我告诉你考虑你的问题。对于更复杂的场景,我建议您查看 ASP.NET SignalR [ ^ ]。



如果您还想知道Facebook,Gmail等是如何做到的。阅读这篇文章 - facebook,gmail如何发送实时通知? [ ^ ]



希望能让你开始走上正确的道路!
Firstly you will have to record the change your second webpage has done. You can also set a flag indicating the change.
In your first web page, you will have to poll the web server to check for any changes in the second page. Basically just check the flag. If there are changes, get the changed values (JSON name-value pair would be great) and update your second page.

That's a very naive implementation I told you considering your question. For more complex scenarios, I would recommend taking a look at ASP.NET SignalR[^].

If you also want to know how Facebook, Gmail etc do it. Read this post - How does facebook, gmail send the real time notification?[^]

Hope that gets you started on a right path!


这篇关于按钮点击事件触发时如何刷新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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