1

I've developed a jQuery comment system here: http://jsfiddle.net/CKqWz/ with the following code:

$(document).ready(function () {
    $("#commentlink1").click(function () {
        $("#commentbox1").toggle("slow");
    });
    $("#commentlink2").click(function () {
        $("#commentbox2").toggle("slow");
    });
});

$(document).ready(function() {
        $("#post_box").click(function() {
        $('#post_btn').show('slow');
    });

        $("#post_box").blur(function() {
        $('#post_btn').hide('slow');
    });
});

I was wondering how do I go about getting the messages and comments to "stick" once the user clicks the comment button.

By "stick" I mean update the page instantaneously with a new message or comment and allow the user to write another message or comment if they want to. Hopefully that makes sense - I am trying to develop something similar to the Facebook commenting system.

I need to use this as a basis for developing the AJAX which will send this information to the database.

1 Answer 1

1

For realtime update of a page or a part of a page, you must be using "Comet" technology, such as forever-iframe with script tag injection, long polling of a server, JSON polling of a server etc.

Also HTML5 WebSockets is a newer option.

Either way you must fall back to long polling or JSON polling too just in case.

For example, Socket.io for Node.js does this automatically.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.