access class function inside ajax success
<p>im trying to assign a variable inside the ajax success callback.
i know that in order to assign the value i need to use a call back function. but i want that function to be inside the class. is it possible to implement something like this?</p>

<pre><code>function callMgmt_class() {

        this.room_id                = 'Error';

        this.assignRoomVar = function(room_id) {

            alert();
            this.room_id = room_id;

        }
        this.getRoomID = function() {

            $.ajax({

                url: "/get_room_id.php",
                dataType: "json",
                success: function(data) {

                    this.assignRoomVar(data.room_id);

                }

            })

        }
    }
</code></pre>

<p>is there some way to use bind?
i tried:</p>

<pre><code>success: function(data) {

    (function() { this.assignRoomVar(data.room_id); }).bind(this);

}
</code></pre>

<p>so i dont get any errors but the function does not seem to be called.</p>