Skip to content

Instantly share code, notes, and snippets.

@andrewcrook
Created July 1, 2011 10:38
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 andrewcrook/1058283 to your computer and use it in GitHub Desktop.
Save andrewcrook/1058283 to your computer and use it in GitHub Desktop.
sammy.js redirect problem
var app = $.sammy( function() {
this.get('#/', function() {
$('#main').html('nothing to see here!');
});
this.get('#/test', function() {
$('#main').html('worked');
});
};
$( function() {
$('#button').live('click', function(e) {
// window.location = '#/test' << Hack that works
// following fails "redirect is not a function"
app.redirect('#/test');
};
app.run('#/');
})(jQuery);
@goli55
Copy link

goli55 commented Mar 2, 2015

try this -

var self,
app = $.sammy( function() {

this.get('#/', function() {
self=this;
$('#main').html('nothing to see here!');
});
.....

//app.redirect('#/test');
self.redirect('#/test');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment