<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -12,29 +12,40 @@ Motivation
     At first I adopted the EJS library(www.embeddedjs.com) which was aimed
     at Ruby on Rails developers, but found myself constantly rewriting
     my HTML::Template files to fit the Rails template syntax. Changes in
-    the markup or presentation logic in one template had to be duplicated.
+    the markup or presentation logic in one template had to be duplicated
+    across our two templates.
     
-    Using PerlTemplates, we keep one copy of each template and it's also
-    great simplified AJAX handling in our perl scripts. We can take code 
+    Using PerlTemplates, we only to keep one template. It has also
+    simplified the AJAX handling logic in our perl scripts. We can take code 
     that looks like this:
     
-        my $template = HTML::Template-&gt;new('/path/to/template.tmpl');
+        my $template = HTML::Template-&gt;new('/path/to/search/results.tmpl');
         $template-&gt;param(%values); # where values contains the template data structure
         print CGI-&gt;header, $template-&gt;output();
     
     Into this:
     
-    if($ajax_request)
-    {
-       print CGI-&gt;header, JSON-&gt;new-&gt;encode(%values);        
-    }
-    else
-    {
-        my $template = HTML::Template-&gt;new('/path/to/template.tmpl');
-        $template-&gt;param(%values);
-        print CGI-&gt;header, $template-&gt;output();
-    }
+        if($ajax_request)
+        {
+            print CGI-&gt;header, JSON-&gt;new-&gt;encode(%values);        
+        }
+        else
+        {
+            my $template = HTML::Template-&gt;new('/path/to/search/results.tmpl');
+            $template-&gt;param(%values);
+            print CGI-&gt;header, $template-&gt;output();
+        }
+    
+    And the JavaScript to support this (with jQuery) becomes:
+    
+        $.getJSON('/search/results', function(json_data) {
+            var tmpl = new PerlTemplates({url:'results.tmpl', data: json_data, target: 'search-results'});
+            tmpl.render();
+        }
+        
+    And now we have a both an AJAX and non-JavaScript version of our search results script.
     
+        
 
 Caveats
 </diff>
      <filename>README</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>bf57c8a6b61b5ff4eeb930460efab1168656baef</id>
    </parent>
  </parents>
  <author>
    <name>DavidMcLaughlin</name>
    <email>david@dmclaughlin.com</email>
  </author>
  <url>http://github.com/DavidMcLaughlin/PerlTemplates/commit/490298ab95f11aad6169ecc893ff5d48f68c2e94</url>
  <id>490298ab95f11aad6169ecc893ff5d48f68c2e94</id>
  <committed-date>2009-04-26T09:41:56-07:00</committed-date>
  <authored-date>2009-04-26T09:41:56-07:00</authored-date>
  <message>upgraded README</message>
  <tree>86b2009bdc57f8b78d2cb260fa0f52ecc2c38c9b</tree>
  <committer>
    <name>DavidMcLaughlin</name>
    <email>david@dmclaughlin.com</email>
  </committer>
</commit>
