PHP ajax with jquery slidedown

i have a complicated PHP conundrum. I have a constantly updating table in my database (Lets call it TABLE) with multiple records being added a second, these results will be posted using PHP on a page (page.php) using AJAX.

The maximum amount of posts shown are 1 every three seconds, for which i have a relevancy algorithm. I don't know how to merge the jquery transitions with the constantly updated records from the table (Got by AJAX).The best i came up with isn't much better than a hack, and dosen't accomadate for an infinite number of posts.



PHP: Not required


<div id='5' class='post'></div>
<div id='4' class='post'></div>
<div id='3' class='post'></div>
<div id='2' class='post'></div>
<div id='1' class='post'></div>

I don't know what to do with AJAX.

Any help would be greatly appreciated,



If your question is simply how to slidedown the newest appended div, try this:


<div id="updatePanel">
    <div id='div5' class='post'></div>
    <div id='div4' class='post'></div>
    <div id='div3' class='post'></div>
    <div id='div2' class='post'></div>
    <div id='div1' class='post'></div>

Note: id attributes starting with numbers are invalid.


setInterval(getData, 3000);

function getData() {
    // call ajax, get data.
    // success: function () {...
    var id = parseInt($("#updatePanel div:first").attr("id").replace("div", "")) + 1;

    $div = $("<div></div>").attr("id", id)
        .css("display", "none") // change this to be a class - this is just to make it clear.

Example fiddle

I'm not sure, but is this basically checking for new posts every three seconds, and then displaying them with a slide down?

If so, once you've pulled the new posts with ajax, append/prepend the code to a wrapper container, preset to div to hidden, and then slide it down.

I can help with code if this is what you want but you'll need to post your ajax so I can get a better idea.

Need Your Help

Form validation on Button click in android

android validation onclicklistener android-spinner buttonclick

I'm Developing an android app in which the Login activity has editText,RadioButton,Spinner and a button.So when the button is pressed I've to validate my form by checking whether all the fields fil...

Show the variable in the Message Box from Method Class

c# .net winforms

I having a problem on how can I show the variable hours from my method class when the user click the button in my form then the variable/term will show it the message box.