Jquery-using php to update content in real time can be immediately displayed when a microblog is published like Sina Weibo

Source: Internet
Author: User
Using php to update content in real time can be immediately displayed when a microblog is sent like Sina Weibo. Could you please give me some comments? How should I write this code ?? Using php to update content in real time can be immediately displayed when a microblog is sent like Sina Weibo. Could you please give me some comments? How should I write this code ??

Reply content:

Using php to update content in real time can be immediately displayed when a microblog is sent like Sina Weibo. Could you please give me some comments? How should I write this code ??

JavaScript,FormForm to makeOnsubmitAnd then obtain the content in the input box.AjaxPOST to the backend. After the backend is successfully inserted into the databaseHTTP response headerReturn201 Created, Front-endJavaScriptGenerate an HTML element from the POST text and insert it into the original DOM tree.

Every English word is a keyword. If you don't understand it, google it.

The real-time display of Sina Weibo is actually when the content is successfully published, the JS directly writes the content filtered and formatted on the server side to the page, the method is different from what @ yegle said.

The main reason is that the implementation of @ yegle requires that the JS end be able to implement the same filtering and processing of the content, but in fact, there are few scenarios where this can be done on Web 2.0 sites, the content is usually associated with other user data to have all the functions.

The reason why JS directly writes the content that has been processed by the server to the page is that Weibo's distribution takes time and what it just sent cannot be immediately displayed in the feed stream, therefore, this operation is available.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.