title: Freebase - MQL in Javascript
body: <p>the example on the freebase site </p>
  
  <p><a href="http://wiki.freebase.com/wiki/MQL_Manual_Javascript_Example" rel="nofollow">http://wiki.freebase.com/wiki/MQL_Manual_Javascript_Example</a></p>
  
  <p>uses <a href="http://api.freebase.com/api/service/mqlread" rel="nofollow">http://api.freebase.com/api/service/mqlread</a></p>
  
  <pre><code>&lt;script&gt;                                
  function listAlbums(band) {     // Display albums by the specified band.
      var envelope = {                       // The mqlread query envelope
      query : {                          // The MQL query 
          type: "/music/artist",         // Find a band
          name: band,                    // With the specified name
          album: [{                      // We want to know about albums
          name:null,                 // Return album names
          release_date:null,         // And release dates
          sort: "release_date",      // Order by release date
          "release_type!=":"single"  // Don't include singles
          }]
      }
      };
  
      var output = $("#output");                          // Output goes here
      output.html("&lt;h1&gt;Albums by " + band + "&lt;/h1&gt;");     // Display a title
  
      // Invoke mqlread and call the function below when it is done.
      // Adding callback=? to the URL makes jQuery do JSONP instead of XHR.
      jQuery.getJSON("http://api.freebase.com/api/service/mqlread?callback=?",
             {query: JSON.stringify(envelope)},   // URL parameters
             displayResults);                     // Callback function
  
      // This function is invoked when we get the result of our MQL query
      function displayResults(response) {  
      if (response.code == "/api/status/ok" &amp;&amp;        
          response.result &amp;&amp; response.result.album) { // Check for success...
          var list = $("&lt;ul&gt;");                       // Make &lt;ul&gt; tag.
          output.append(list.hide())                  // Keep it hidden
          var albums = response.result.album;         // Get albums.
          jQuery.each(albums, function() {            // Loop through albums.
          list.append($("&lt;li&gt;").html(this.name)); // Make &lt;li&gt; for each.
          });
          list.show("normal");                        // Reveal the list
      }
      else {                                          // On failure...
          output.append("Unknown band: " + band);     // Display message.
      }
      }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>that's apparently deprecated; are there any examples of code using the new <a href="https://www.googleapis.com/freebase/v1/mqlread" rel="nofollow">https://www.googleapis.com/freebase/v1/mqlread</a> API? Can't seem to find much online (I'm still learning the ropes).</p>