Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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