Skip to content
Judson edited this page Jul 6, 2011 · 2 revisions

In an HTML page, you’ll start with:

<script src="js/jquery-1.6.js"></script>
<script src="js/ns.min.js"></script>

and then either:

<script>
  <!-- Ninjascript stuff here -->
</script>

or

<script src='js/behaviors.js'></script> <!-- behaviors is where the Ninjascript stuff goes -->

Pretty much like you’d expect. Note that at the moment, Ninjascript requires jquery (1.4+) to already be loaded. We’re examining that requirement, but it’s pretty much unreasonable to package a whole extra copy of jQuery, when most people will be using it anyway.

The “Ninjascript stuff” you can do in a host document looks like this:

<script>
Ninja.behavior({
  ".coolthing": submitsAsAjax()
})
</script>
Clone this wiki locally