Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in $.ajax() how to read this.id #7

Open
raymondZhong opened this issue Dec 5, 2014 · 1 comment
Open

in $.ajax() how to read this.id #7

raymondZhong opened this issue Dec 5, 2014 · 1 comment

Comments

@raymondZhong
Copy link

in $.ajax() how to read this.id

var PageLoader = my.Class({
index:0,
count:0,
id:$.uuid(),
constructor: function(url) {
this.url = url;
var _self = this;

         $.ajax({
               url: this.url,
               success: function(msg){
                 alert(this.id)      // this is  error
               }
            });

    } 

});

@Xananax
Copy link

Xananax commented Dec 27, 2014

You set a variable "_self" yourself, so just use it:

$.ajax({
  url:_self.url,
  success:function(msg){
   alert(_self.id);
  }
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants