<!DOCTYPE html>
<!--
Copyright 2013 The Polymer Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1.0">
  <title>Ajax</title>
  <script src="../../polymer/polymer.js"></script>
  <link rel="import" href="../elements/g-ajax.html">
</head>
<body>
  <g-ajax auto url="http://gdata.youtube.com/feeds/api/videos/" 
          params='{"alt":"json", "q":"chrome"}'
          handleAs="json">
  </g-ajax>
  <template repeat="{{response.feed.entry}}">
    <div>{{title.$t}}</div>
  </template>
  <script>
    document.addEventListener('WebComponentsReady', function() {
      var ajax = document.querySelector("g-ajax");
      ajax.addEventListener("response", 
        function(inEvent) {
          document.querySelector('template').model = {
            response: inEvent.detail.response
          };
        }
      );
    });
  </script>
</body>
</html>
