Is there a way to trigger a server event using jQuery or ASP.NET MVC?

I have this situation: I have a page where I have a list of events of the day. And these events can be changed to the status of "Confirmed" or "Canceled".

But, when I, for example, click “Confirmed”, this status is saved on SQL Server, and this status is displayed “Confirmed”. But, if another person has the same page, open at the time when I changed the status of the event, this person will NOT see the new status. He will only see if the page reloads.

I know that there is an Ajax set TimeOut that refreshes the page after every 5 ... 10 ... 15 seconds. But I was thinking if there is a jQuery or ASP.NET MVC trigger, when I change the status of the event, the server responds with a browser update.

Is there any solution for this?

Thanks!!

+3
source share
3 answers

Option 1 . Use jQuery Timer and refresh your control on the page every X seconds. (You do not need to reload the entire page, just the status of your controls with confirmed / canceled statuses and change them only if the server returned new values).

Option 2 . You can configure the event on the page from your server using Silverlight 2 +.

. (/), . , , , , .

+1

: .

, . , . , . -, .

0

You can use asynchronous handlers in ASP.NET to implement this. This means that you can subscribe to the update event on the server, and the server contains a request (which does not consume any workflow at the same time), and when the status is updated, the request ends and a response with a new status is sent to the client.

0
source

Source: https://habr.com/ru/post/1705742/


All Articles