Skip to content

Instantly share code, notes, and snippets.

@tjweir
Created November 18, 2008 01:32
Show Gist options
  • Save tjweir/26017 to your computer and use it in GitHub Desktop.
Save tjweir/26017 to your computer and use it in GitHub Desktop.
undefined
package com.quotelibrary.snippet
import _root_.net.liftweb.http._
import S._
import SHtml._
import js._
import JsCmds._
import JE._
import _root_.net.liftweb.util._
import Helpers._
import _root_.scala.xml._
// Foo
class Json {
object json extends JsonHandler {
def apply(in: Any): JsCmd =
SetHtml("json_result", in match {
case JsonCmd("show", _, p: String, _) => Text(in.toString)
case JsonCmd("count", _, p: String, _) => Text(p.length+" Characters")
case x => <b>Problem... didn't handle JSON message {x}</b>
})
}
def sample = {
<span>
{Script(json.jsCmd)}
<textarea id="json_question" rows="4" cols="50">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment