DWQA QuestionsCategory: ProgramHow did the message prompt box in segmentfault come out?
ccc asked 8 months ago

How did the message prompt box in segmentfault come out?
Is the question box that will appear on the top of the page after the question is raised? Is there a library of JS? If you write it yourself, what is the principle? Do you want to rewrite the alert in JS?

Childe replied 8 months ago

Put one in the front section beforehand.<div id="message"></div>The back end operates on user data and returns a JSON file with contents such as{status: 200, message:'Your problem has been created and it will appear in the list of problems later'}And then the previous JS gets the file, according tostatusoperationdiv#messageCSS attributes such as color, 200 is yellow, 404 is red and so on.messageThe content is put indiv#messageGo inside.

5 Answers
Best Answer
honglio answered 8 months ago

You can refer to the following example.Please enter a link description.

Time permits answered 8 months ago

It’s just adding one to that location in the web page.<div>Use CSS with a little style. The default is hidden. When there is a message, the text is updated and displayed.

Childe answered 8 months ago

Hahaha, I’m here to test.

Childe answered 8 months ago


Wood LBJ answered 8 months ago

http://www.bootcss.com/p/messenger/Recommend this plug-in to support ajax. The principle is that when the problem is clicked, the background operation is completed, and the data is returned after completion, and the foreground displays the message. The plug-in above can achieve this effect, and there are many styles to choose from.