class - tweet - 0 - to_do
So, this is the PHP that causes you to have your 'aml' processing here.

I think people must have confused you by saying not to echo.  You are correct, you do have to communicate by printing something out.  The best way to communicate with Javascript is by using JSON.  JSON stands for JavaScript Object Notation.

You should also check for success or failure from the database query.  Below is untested code (I have no idea what your database::query returns so my error check may not be appropriate):

$query_return = database::query("SELECT * FROM tw ORDER BY time DESC LIMIT 7");

if ($query_return === false)
{
    echo json_encode(array('Success' =&gt; false));
    return;
}   

$results = array('Data'    =&gt; array(),
                 'Success' =&gt; true);

while($row = mysqli_fetch_assoc($query_return))
{  
    $results['Data'][] = $row;
}

echo json_encode($results);


So now you will receive an array of rows from your database that your javascript code can deal with nicely.  It will be a valid javascript object so you can check it with:

if (response.Success)
{
    // Do stuff with response.Data here.  Probably a loop over the results.
}