setTimeout for each instance of object
<p>I have this object (this is only part of it, obviously...):</p>

<pre><code>function room() {
    this.data = {
        sender_name: '',
        room_id: 0
    }
    this.create = function (sender_name) {
        // (code to set this.data)
        this.removeTimer();
    }
    this.removeTimer = function() {
        var t = this;
        console.log(t.data.sender_name) // log #1

        $.tGet('roomInfo', {'room_id': this.data.room_id}, function(edata) {
            console.log(t.data.sender_name) // log #2
            if(edata.exists == 'false') {
                // remove room code...
            }
            else {
                setTimeout(function() {
                    t.removeTimer();
                }, 1000)
            }
        })
    };
}
</code></pre>

<p>and I create its instances from DB like this:</p>

<pre><code>$.tGet('getRooms', {'user_id': mUser}, function(edata) {
    var i = 0, n;
    for(i = 0; i&lt;edata.length; i++) {
        n = new room();
        n.create(edata[i].sender_name);
    }
})
</code></pre>

<p>Now, the problem is that what console prints is only the last room created. I don't know what's going on...</p>

<p>The first time this code runs, log #1 is completely correct. However, log #2 is already problematic because it gives me only the last room in the DB (or in the loop...) and, of course, after the timeout log #1 becomes wrong too.</p>

<p>What's going on? I'm really just a begginer at javascript, so... </p>

<hr>

<p><code>tGet</code> function:</p>

<pre><code>$.tGet = function(action, data, callback, error) { 
    $.get('php/ajax.php?action='+action, data, callback, 'json').fail(error); 
} 
</code></pre>
