title: uncaught typeerror on calling $.load() function
body: <p>I am constructing a page from a JSON using javascript. I am trying to follow a OOJS in building the page. </p>
  
  <p>How I am getting the JSON : I am using RESTful api to get the JSON.</p>
  
  <p>Once I get the JSON I am using jquery to convert it into a json object and then use the OOJS objects to convert them into the page content. </p>
  
  <p>I am loading facets on the left hand side and results on the right hand side. When I click on the link of the left the complete page should refresh. I am using the results and facets objects to create the page.</p>
  
  <p>Now I am facing problem in calling the loadPage(callbackurl). I am getting a JS error</p>
  
  <pre><code>Uncaught TypeError: object is not a function 
  </code></pre>
  
  <p>Have attached the files below. Any advice would be helpful. Thanks in advance</p>
  
  <p>HTML Page : </p>
  
  <pre><code>    &lt;!DOCTYPE html&gt;
      &lt;html lang="en"&gt;
          &lt;head&gt;  
              &lt;title&gt;&lt;/title&gt;
              &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
              &lt;link href="assets/css/faceted-search.css" rel="stylesheet" /&gt;
              &lt;script src="js/mcu.json"&gt;&lt;/script&gt;
              &lt;script src="js/facets.js"&gt;&lt;/script&gt;
              &lt;script src="js/results.js"&gt;&lt;/script&gt;
              &lt;script src="js/tags.js"&gt;&lt;/script&gt;
              &lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt;
              &lt;script&gt;
                  function getUrlVars()
                  {
                      var vars = [], hash;
                      var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&amp;');
                      for(var i = 0; i &lt; hashes.length; i++)
                      {
                          hash = hashes[i].split('=');
                          vars.push(hash[0]);
                          vars[hash[0]] = hash[1];
                      }
                      return vars;
                  }
              &lt;/script&gt;
  
              &lt;script&gt;
                  // Get the values from the query string
                      var results;
                      var facets;
                      function loadPage(callbackurl){
                      var query = getUrlVars()["query"];
                      $("#hidecontent").load(callbackurl, function(response, status, xhr){
                          query = query.replace("%20", " ");
                          $('input#inputsearch').val(query);
                          //var mcu = response;
                          jsonObj = $.parseJSON(response);
                          results = new results(jsonObj);
                          results.createResults("results");
  
                      $('div#facets').find('div.content').find('div.topDiv').find('div').find('a').click(function(e){
                              console.log(e);
                              var facetsDiv = $('div#facets').find('div.content');
                              var querystring = 'rest/nxp-facetSearch?query=' + $('input#inputsearch').val() + '&amp;facet='  + $(this).parent().parent().parent().attr('id')+ "~" + $(this).attr('id') ;
                              loadPage(querystring);
  
                              $.each(facetsDiv, function(){
                                      // If length of the selector &gt; 0 then true else false
                                      var selectedfacetvalues = $(this).find('a.selected');
                                      var selectedstring = "";
                                      if(selectedfacetvalues.length){
                                          $.each(selectedfacetvalues, function(){
                                              selectedstring = selectedstring + $(this).attr('id') + ",";
                                          });
                                          querystring = querystring + $(this).attr('id') + "~" + selectedstring.slice(0, -1) + ";";
                                      }
  
                              });
                              console.log(querystring);
                          });                    
                      });
  
  
                  }
  
  
              &lt;/script&gt;
          &lt;/head&gt;
      &lt;body&gt;
          &lt;div id="hidecontent" style="display: none"&gt;
  
          &lt;/div&gt;
          &lt;div id="topheader"&gt;
              &lt;img src="images/NXP_logo.png" /&gt;
          &lt;/div&gt;
          &lt;div id="framecontent"&gt;
              &lt;div id="facets" class="innertube"&gt;
                  &lt;div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div id="searchbox"&gt;
              &lt;input id="inputsearch" type="text" value="" size="40" /&gt;&amp;nbsp; &lt;img class="searchimg" src="images/Search.png" style="cursor: pointer" /&gt;
          &lt;/div&gt;
          &lt;!--div id="tags"&gt;
  
          &lt;/div--&gt;
          &lt;div id="maincontent"&gt;
                  &lt;p&gt;&amp;nbsp;&lt;/p&gt;
                  &lt;div id="results"&gt;
  
                  &lt;/div&gt;
          &lt;/div&gt;
          &lt;script&gt;
              var query = getUrlVars()["query"];
  
              callbackurl = "rest/nxp-facetSearch?query=" + query + "";
              loadPage(callbackurl);
          &lt;/script&gt;
  
  
  
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>JSON file :</p>
  
  <p>Please let me know if I need to attach the json file too.</p>
  
  <p>Result.js : </p>
  
  <pre><code>    /* 
       * To change this template, choose Tools | Templates
       * and open the template in the editor.
       */
  
      var localObject;
  
      function results(){
  
      }
  
      function results(jsonObject){
          localObject = jsonObject;
      }
  
      results.prototype.createResults = function(targetID){
          resultsDiv = document.getElementById(targetID);
          resultsDiv.innerHTML = "";
          container = document.createElement("div");
          container.setAttribute("id", "container");
          resultsDiv.appendChild(container);
          var values = localObject.results;
          if(values.length &gt; 0){
              results.createTable(resultsDiv, values);
          }else{
              var noresults = document.createElement("span");
              noresults.innerHTML = "No results found!";
              resultsDiv.appendChild(noresults);
          }
      }
  
      results.prototype.createTable = function(resultsDiv, values){
          var topdiv = document.createElement("div");
          //table.setAttribute("class", "products");
          for (var v in values)
          {
              var div = document.createElement("div");
              var span = document.createElement("span");
              var p = document.createElement("p");
              span.setAttribute("class", values[v].type);
              div.setAttribute("class", "column");
              p.setAttribute("class", "resultcolumnvalue");
              p.innerHTML = values[v].value ;
              div.appendChild(span);
              div.appendChild(p);
  
              topdiv.appendChild(div);
          }
          resultsDiv.appendChild(topdiv);
      }
  </code></pre>