I want to create an javaScript object to manage MySQL database table.
In doing that I have coded the following script in which I call the
ajax 'Ajax.Request' call to get the table metadata and to update the
object attribute (this.tableMetaData) with what is returend from the
Ajax request. However it seems that Ajax.Request change the scope of
functions to 'window' and as a result this.tableMetaData attribute is
not identified by the onSuccess function as a property of the current
object. How can I inform the onSuccess function that
this.tableMetaData is an attribute of the current object?


function table(tableName){
        this.tableName = tableName;
        this.tableMetaData ="";
        this.inputFields = new Array();

        // Get the table metadata


       var myRequest = new Ajax.Request('tableManager.php', {
        method: 'post',
        parameters: { Mode:'getMetaData',table: this.tableName},
        onSuccess: function(transport){
                this.tableMetaData = transport,         },
                onFailure: function(){
                        this.error("Table object construction failed");
                }
     });

}


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to