Author: buildbot
Date: Wed Mar 26 22:30:58 2014
New Revision: 903849

Log:
Staging update by buildbot for thrift

Modified:
    websites/staging/thrift/trunk/content/   (props changed)
    websites/staging/thrift/trunk/content/tutorial/js.html

Propchange: websites/staging/thrift/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Mar 26 22:30:58 2014
@@ -1 +1 @@
-1582096
+1582097

Modified: websites/staging/thrift/trunk/content/tutorial/js.html
==============================================================================
--- websites/staging/thrift/trunk/content/tutorial/js.html (original)
+++ websites/staging/thrift/trunk/content/tutorial/js.html Wed Mar 26 22:30:58 
2014
@@ -94,26 +94,22 @@
 <h3 id="client">Client</h3>
 <p><pre><code class="language-js">
 function calc() {
-        var transport = new Thrift.Transport("/thrift/service/tutorial/");
-        var protocol  = new Thrift.Protocol(transport);
-        var client    = new CalculatorClient(protocol);</p>
-<div class="codehilite"><pre>    <span class="n">var</span> <span 
class="n">work</span> <span class="p">=</span> <span class="n">new</span> <span 
class="n">Work</span><span class="p">()</span>
-    <span class="n">work</span><span class="p">.</span><span 
class="n">num1</span> <span class="p">=</span> $<span 
class="p">(</span>&quot;#<span class="n">num1</span>&quot;<span 
class="p">).</span><span class="n">val</span><span class="p">();</span>
-    <span class="n">work</span><span class="p">.</span><span 
class="n">num2</span> <span class="p">=</span> $<span 
class="p">(</span>&quot;#<span class="n">num2</span>&quot;<span 
class="p">).</span><span class="n">val</span><span class="p">();</span>
-    <span class="n">work</span><span class="p">.</span><span 
class="n">op</span> <span class="p">=</span> $<span 
class="p">(</span>&quot;#<span class="n">op</span>&quot;<span 
class="p">).</span><span class="n">val</span><span class="p">();</span>
-
-    <span class="k">try</span> <span class="p">{</span>
-      <span class="n">result</span> <span class="p">=</span> <span 
class="n">client</span><span class="p">.</span><span 
class="n">calculate</span><span class="p">(</span>1<span class="p">,</span> 
<span class="n">work</span><span class="p">);</span>
-      $<span class="p">(</span><span class="s">&#39;#result&#39;</span><span 
class="p">).</span><span class="n">val</span><span class="p">(</span><span 
class="n">result</span><span class="p">);</span>
-      $<span class="p">(</span><span class="s">&#39;#result&#39;</span><span 
class="p">).</span><span class="n">css</span><span class="p">(</span><span 
class="s">&#39;color&#39;</span><span class="p">,</span> <span 
class="s">&#39;black&#39;</span><span class="p">);</span>
-    <span class="p">}</span> <span class="k">catch</span><span 
class="p">(</span><span class="n">ouch</span><span class="p">){</span>
-      $<span class="p">(</span><span class="s">&#39;#result&#39;</span><span 
class="p">).</span><span class="n">val</span><span class="p">(</span><span 
class="n">ouch</span><span class="p">.</span><span class="nb">why</span><span 
class="p">);</span>
-      $<span class="p">(</span><span class="s">&#39;#result&#39;</span><span 
class="p">).</span><span class="n">css</span><span class="p">(</span><span 
class="s">&#39;color&#39;</span><span class="p">,</span> <span 
class="s">&#39;red&#39;</span><span class="p">);</span>
-    <span class="p">}</span>
-</pre></div>
-
-
-<p>}
+  var transport = new Thrift.Transport("/thrift/service/tutorial/");
+  var protocol  = new Thrift.Protocol(transport);
+  var client    = new CalculatorClient(protocol);</p>
+<p>var work = new Work()
+  work.num1 = $("#num1").val();
+  work.num2 = $("#num2").val();
+  work.op = $("#op").val();</p>
+<p>try {
+    result = client.calculate(1, work);
+    $('#result').val(result);
+    $('#result').css('color', 'black');
+  } catch(ouch){
+    $('#result').val(ouch.why);
+    $('#result').css('color', 'red');
+  }
+}
 </code></pre></p>
 <h3 id="server">Server</h3>
 <p>Use either the <a href="/tutorial/java">Java tutorial</a> or <a 
href="/tutorial/cpp">C++ tutorial</a> server </p>


Reply via email to