Thanks, It works
On Feb 23, 3:49 pm, "Nikodim Lazarov" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Try binding the onSuccess function with 'this':
>
> onSuccess: function(transport){
> this.tableMetaData = transport, }.bind(this)
>
> Thus you will keep the scope at the current object.
>
> Regards,
> Niko
>
>
>
>
>
> On Sat, 23 Feb 2008 11:41:05 +0200, damitha <[EMAIL PROTECTED]> wrote:
>
> > 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");
> > }
> > });
>
> > }
>
> --
> Best Regards,
> Nikodim Lazarov- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---