You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2014/03/26 23:17:41 UTC

svn commit: r1582089 - /thrift/cms-site/trunk/content/tutorial/js.md

Author: roger
Date: Wed Mar 26 22:17:41 2014
New Revision: 1582089

URL: http://svn.apache.org/r1582089
Log:
use 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=1582089&r1=1582088&r2=1582089&view=diff
==============================================================================
--- thrift/cms-site/trunk/content/tutorial/js.md (original)
+++ thrift/cms-site/trunk/content/tutorial/js.md Wed Mar 26 22:17:41 2014
@@ -8,28 +8,8 @@ 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