Reputation: 107
I write program in Asp.Net 4.0 this:
- client send json to server
- Http Handler get this Json and save into sql server table
- My page refresh the page with javascript code per 5 second
- in page show the client send data!
But I want delete step 3 and replace with this method:
Without refresh the page my page read sql server table and show in gridview
For example in Facebook page when the user comment on my post, page without refresh show this comment, how can i solve this problem?
Upvotes: 1
Views: 954
Reputation: 7462
You have couple of options here.
Setinterval
in javascript and periodically make ajax call to handler to fetch data and render in page. E.g. - http://www.w3schools.com/jsref/met_win_setinterval.aspSignalR
) , that will use HTML5 websocket (depending on browser compatibility) to fetch data and broadcast that data to all connected browsers. -http://www.asp.net/signalr/overview/getting-started/introduction-to-signalr.Second, option is good one, as this has other fallback methods, such as long polling, server sent event, ajax long polling ( option#1) etc.. Please read details on from that link.
Upvotes: 1