title: How come my callback says "undefined is not a function?
body: <p>I'm calling a function with a callback like this:</p>
  
  <pre><code>$(function() {
      //get all the items
      search.init('.result tbody tr');
      search.parseresults(function(announcementID){
          //query every single page
          var myCompany = new company(announcementID);
          myCompany.requestPage(function(){
              //on response parse the data.
              myCompany.parsedata()
              var myPerson = new person(myCompany )
              myPerson.getPhone(function(){
                  console.log('test')
              });
          })
      });
  });
  </code></pre>
  
  <p>It's the last callback with console.log('test') that is the problem.</p>
  
  <p>this is the getPhone-function:</p>
  
  <pre><code>person.prototype.getPhone = function(callback){
      this.attempt++
      if( this.attempt === 1){
          var who = this.lastname;
          var where = this.adress+' '+this.postal;
      }else if(this.attempt === 2){
          var who = this.firstname+' '+this.lastname;
          var where = this.adress+' '+this.postal;
      }else{
          var who = this.firstname+' '+this.lastname;
          var where = this.adress+' '+this.postal;
          var url = 'http://personer.eniro.se/resultat/'+who+'/'+where;
          console.debug('')
          //console.debug('fail')
          console.debug(url)
          console.debug(this)
          return
      }
      var self = this;
  
      var url = 'http://personer.eniro.se/resultat/'+who+'/'+where;
      GM_xmlhttpRequest({
          method: "GET",
          url: url,
          onload: function(data) {
              data = $.parseHTML(data.response);
              var vCard = $(data).find('.vcard')
              if (vCard.length === 1){
                  var phone = vCard.find('.tel.row a').map(function(){
                      return this.text
                  }).get()
  
                  self.officePhone = phone[0];
                  if(phone.length &gt; 1){
                      self.mobilePhone = phone[1];
                  }else{
                      self.mobilePhone = '';
                  }
                  callback();
  
              } else if(vCard.length &gt; 1){
                  self.getPhone()
              }
          }
      })
  }
  </code></pre>
  
  <p>The callback gets triggered when it's supposed to. But when the callback is present I get the error:</p>
  
  <blockquote>
    <p>undefined is not a function</p>
  </blockquote>