//the main body of my program var app = {}; app.index = function () { S.app.use('Template'); content = S.template('

place: <%= city %>

', { city: 'oslo' }); this.append($(content)); $('#registrationForm').submit(function(){ var x = ($(this).serializeArray()); var doc = {} ; for(i in x){ doc[x[i].name] = x[i].value; } $.couch.db('britannia').saveDoc(doc, { success: function(resp) { alert("parent saved"); } }); return false; }); $('#attendance').submit(function(){ alert("this works"); return false; }); $('#search').submit(function(){ alert("event for this buttom works"); return false; }); }; //routes $(function () { app.s = $.sammy(function () { this.get('', app.index); }) app.s.run(); });