javascript - Posting data dynamically without refreshing the page -


i want know how can post data without refreshing page example, facebook when post comment posted , shown people without refreshing page. know how insert data in mysql without refreshing page ajax question is: how insert data , @ same time without refreshing page.

thank you

osdm's answer might seem accomplish behavior want isn't 1 you're asking about. answer provide updates when user upload's , not created in system (uploaded).

there 2 different ways can accomplish fetching of new information in server: ajax , websockets.

ajax - ajax stands asynchronous javascript , xml. allows fetch content particular server behind scene , can insert newly fetched data page display user. has manually triggered , therefore doesn't happen in real time. trigger fetching of data either manually (e.g. press of button), or on timer (e.g. every 5 seconds, 10 minutes, etc). important note hard server know information page displaying , therefore each ajax call request all of information displayed , re-render page (deletes current content , inserts newly fetched 1 includes content being displayed).

websockets - websockets can thought of 'upgraded' http connection. client , server establish connection , free send data in either direction. can set web sockets between server , website (client) such whenever new content inserted mysql database server relays new content client. ajax, interpret new information , add page. upside of using web sockets information being fed in-real time server receives it. means need fetch data in bulk when first load site , updates pushed occur. not need rely on timer or manual input fetch data you're being fed data , not fetching it.

facebook, example, doesn't rely on timer or fetching new data (although happens if refresh page) each client listening server new information through web sockets.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -