开发者

asp.net mvc update webpage from server

开发者 https://www.devze.com 2022-12-10 20:37 出处:网络
What I\'m trying to do is force a webpage to updat开发者_C百科e with new content without refreshing when it is set on the server.

What I'm trying to do is force a webpage to updat开发者_C百科e with new content without refreshing when it is set on the server.

Ideally a user would be looking at a blank page that would update with specific content when it is set on the server or in the database.

Any ideas on how I could go about doing that?


Traditionally, the client (ie the web browser) would poll the server every so often to fetch new data.

However, there are a number of server push frameworks out there. Have a look at the following article on COMET. I believe this is used by such sites as meebo and Chess.com (for playing live chess online in the browser).


You would need to create a jQuery Ajax call to poll the server every X seconds checking for new content. When the call returns, it would append/prepend the content to the page automatically.


Use ajax to poll the server for new content or use comet

Neither are particularly beautiful solutions, but the web is "connectionless" for now but there are ways round it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号