Author: roger Date: Wed Mar 26 22:29:51 2014 New Revision: 1582096 URL: http://svn.apache.org/r1582096 Log: revert snippet
Modified: thrift/cms-site/trunk/content/tutorial/js.md Modified: thrift/cms-site/trunk/content/tutorial/js.md URL: http://svn.apache.org/viewvc/thrift/cms-site/trunk/content/tutorial/js.md?rev=1582096&r1=1582095&r2=1582096&view=diff ============================================================================== --- thrift/cms-site/trunk/content/tutorial/js.md (original) +++ thrift/cms-site/trunk/content/tutorial/js.md Wed Mar 26 22:29:51 2014 @@ -8,9 +8,27 @@ library_lang: "js" * This tutorial depends on an existing Thrift server. See either the [Java tutorial](/tutorial/java) or [C++ tutorial](/tutorial/cpp) for how to build and setup one of these servers. ### Client - -[snippet:path=tutorial/js/tutorial.html:lang=js:lines=47,65] - +<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); + + var work = new Work() + work.num1 = $("#num1").val(); + work.num2 = $("#num2").val(); + work.op = $("#op").val(); + + 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> ### Server Use either the [Java tutorial](/tutorial/java) or [C++ tutorial](/tutorial/cpp) server