How is a pop-up warning displayed in stackoverflow when you answer a question and someone creates another answer?

Okay, so you know, when you answer a question and are in the middle of entering it, and someone else sends an answer to your question, and you get a small pop-up window that says that there is a new answer to the question? My question is: how do you do this? I think I have a basic concept ... The answer to a question added to the database. Your on page continues to check the database for new answers, and if there is anything new, a popup will be displayed. (I'm not sure what it was, but just an idea). Anyway, am I trying to create an application with similar functionality for this popup using php, and jQuery / Ajax / something else? I have a page that will be on the screen and will display information from the database. What I need: figure out how to get a popup to display only thenwhen new content is added to the database. Thanks for the help!

I should also add ... if anyone has any tutorials or code snippets to share about integrating ajax / jquery with sql, that would be great. I'm pretty decent in PHP, but brand new for ajax and jquery: - /

+3
source share
5 answers

when you first load the question page, also read the number of answers.

Now poll the server using ajax requests every few seconds / minutes, which return the number of responses.

If the number of answers is greater than the number when you first downloaded the question, then show a message that additional answers have been added.

+6
source

, .

, AJAX . count > 0, .

.

+1

Javascript AJAX, diplay HTML . , DOM jQuery.

0

- , , , .

- ajax , . , , .

0

jQuery .

script, JSON, , , . , ajax script ~ 30 . , , . , show() fadeIn(). ( HTML, , / html ajax.

, , . - , .

0
source

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


All Articles