Skip to content

Instantly share code, notes, and snippets.

@tbje
Created March 29, 2010 11:00
Show Gist options
  • Save tbje/347737 to your computer and use it in GitHub Desktop.
Save tbje/347737 to your computer and use it in GitHub Desktop.
def render = {<a onclick={Alert(Call(myFunction, 4, 5))}>Click me</a>}
import net.liftweb.http.js._
import net.liftweb.http.js.JsCmds._
import net.liftweb.http.js.JE._
import net.liftweb.http.js.JE
...
val myFunction = "myFunction"
override lazy val fixedRender: Box[NodeSeq] =
Full(
<head>
<script>{
Function(myFunction, List("arg1", "arg2"),
JsCrVar("myVar", JsVar("arg1") + JsVar("arg2")) &
JsReturn(JsVar("myVar")+10)}
</script>
</head> ++ <p>More fixed content comes here.</p>)
...
def render = {<a onclick={Call("alert", Call(myFunction, 4, 5))}>Click me</a>}
<head>
<script>function myFunction(arg1, arg2) {
var myVar = arg1 + arg2;
return myVar + 10
}
</script>
<head>
...
<div ... ><div ...>
<a onclick="alert(myFunction(4,5))">Click me</a>
</div>
<p>More fixed content comes here.</p>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment