Javascript property accessing issues
<p>I have the following javascript class and for some reason the current property is not being set to -1 when i'm done loading the records (or i'm not able to access the property correctly from an instance of the class). 
I'm new to javascript so any help would be appreciated.</p>

<pre><code>var MyLib = function () {
this.current = 0;

MyLib.prototype.loadMore = function (id, loadingDivId, url) {
    if (this.current &gt; -1) {
        this.current++;
        $(loadingDivId).html("&lt;h3&gt;Loading more records please wait...&lt;/h3&gt;");
        $.get(url + this.current, function (data) {
            if (data != '') {
                $(id).append(data);
                $(loadingDivId).empty();
            } else {
                this.current = -1; // seems like this isn't being set
                $(loadingDivId).html("&lt;h3&gt;&lt;i&gt;-- No more results -- &lt;/i&gt;&lt;/h3&gt;");
            }
        });
    }
}
</code></pre>

<p>};</p>

<p>Here's how i'm calling it</p>

<pre><code>&lt;script type="text/javascript"&gt;
     $(function () {
         var lib = new MyLib();

         $('#loadMore').click(function () {
             if (lib.current &gt; -1) {
                 lib.loadMore("#results", "#loading", '/home/search/');
                 if (lib.current == -1) { 
                     // Having problems getting into this portion
                     $("#loadMore").hide();
                 }

             }
             return false;
         });

     });

&lt;/script&gt;
</code></pre>
