0

does anybody have any idea how the Facebook notification works?

I have this code

(function retrieve_req() {
    $.ajax({
        url: 'request_viewer_and_its_utilities.php',
        success: function(data) {
            $('.internal_load_request_from_extern_page').html(data);
        },
        complete: function() {
            // Schedule the next request when the current one's complete
            setTimeout(retrieve_req, 500);
        }
    });
})();

the problem is that I want to send only one data and if it is found only the append the data any idea how to do that?

Pranav C Balan
  • 113,687
  • 23
  • 165
  • 188
Dev Man
  • 2,114
  • 3
  • 23
  • 38
  • http://stackoverflow.com/questions/12979833/realtime-live-notification-jquery-php – Black Sheep Jan 03 '14 at 18:09
  • aldanux i dont know much about comet etc all i know is php jquery abd ajax so if you could guide me in the right direction? – Dev Man Jan 03 '14 at 18:12
  • Well, the "_best_" if you start to learn **[node.js](http://nodejs.org/)** and **[socket.io](http://socket.io/)** or **[websocket](http://en.wikipedia.org/wiki/WebSocket)** (only modern browser) for live push notifications, chat etc.., if you want a simpler solution you can use for example **[Long Polling](http://en.wikipedia.org/wiki/Push_technology)** Search in Google, there are a lot of examples! Good luck! :) – Black Sheep Jan 03 '14 at 18:33

1 Answers1

0

Easy :

In the result of request_viewer_and_its_utilities.php, you return the code, is 0 is OK, is not 0 is not OK, in the logic in request_viewer_and_its_utilities.php, use try , catch to control some exception to insert data.

iflores
  • 43
  • 7