Skip to content

Instantly share code, notes, and snippets.

@wtnabe
Created March 6, 2011 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wtnabe/857143 to your computer and use it in GitHub Desktop.
Save wtnabe/857143 to your computer and use it in GitHub Desktop.
My first javascript routing with jQuery-Router & LABjs
jQuery( function($) {
$.route(
{
path: /^\/$/,
func: function() {
$LAB.script('/javascripts/console_hello.js');
}
},
{
path: /^\/hello/,
func: function() {
$LAB.script('/javascripts/alert_hello.js');
}
});
});
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><%= @title %></title>
</head>
<body>
<h1><%= @title %></h1>
<%== yield %>
<script type="text/javascript" src="/javascripts/lab.js"></script>
<script type="text/javascript">
$LAB.script('/javascripts/jquery-1.5.1.min.js').
script( '/javascripts/jquery.Router.js' ).wait().
script( '/javascripts/application.js' );
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment