How do I access members in John Resig's class in ajax callbacks?
<p>I am using John resig's implementation class mentioned here: <a href="http://ejohn.org/blog/simple-javascript-inheritance/" rel="nofollow">http://ejohn.org/blog/simple-javascript-inheritance/</a></p>

<p>Now I have a function, which is actually a callback supplied to an ajax method. Now, how do I access the class members inside this function?</p>

<p><strong>---EDIT---</strong></p>

<p><strong>CASE I</strong></p>

<p>Suppose, here is the class I defined:</p>

<pre><code>var Person = Class.extend({
  init: function(isDancing){
    this.dancing = isDancing;
  },
  dance: function(){
    return this.dancing;
  }
});
</code></pre>

<p>And I use it like:</p>

<pre><code>var p = new Person(true);

$.ajax({url: url, success: p.dance}); 
</code></pre>

<p>Then, in the dance method, this.dancing wont work, because this wont point to the object p.</p>

<p><strong>CASE II:</strong></p>

<p>I am using knockoutjs (http://knockoutjs.com) for binding my UI to the objects. Suppose we have:</p>

<pre><code>var AppViewModel = Class.extend({
  person: new Person()
});
</code></pre>

<p>and binding in html would be:</p>

<pre><code>&lt;button data-bind="click: person.dance"&gt;Dance&lt;/button&gt;
</code></pre>

<p>in this case, the 'this' in dance would point to the object of AppViewModel, and not person.</p>

<p>The latter case is more important for me.</p>
