I am using sammy.js
plugin in my single page application. The plugin is not working, whenever user tries to navigate in the page it is showing the following error on console :
[Tue Dec 04 2012 17:48:13 GMT+0530 (India Standard Time)] #main 404 Not Found get /page_home
Error
arguments: undefined
get stack: function () { [native code] }
message: "404 Not Found get /page_home "
set stack: function () { [native code] }
type: undefined
__proto__: d
What is this issue and how can it be fixed ?
EDIT
Sammy configuration code:
var app = $.sammy('#main', function () {
this.get('#/:name', function () {
var id = this.params['name'];
$.trim(id);
var flag = true;
if ($("#main").hasClass("presentation")) {
$.each(slides, function (i, v) {
if ($(v).attr("class") == id) {
ScanNavigationD(id);
flag = false;
return false;
}
});
if (flag) {
ScanNavigationD($(slides[0]).attr("class"));
}
}
else if ($("#main").hasClass("printdoc") || typeof $("#main").attr("class") == "undefined") {
$.each(Pages, function (i, v) {
if ($(v).attr("class") == id) {
ScanNavigationD(id);
flag = false;
return false;
}
});
if (flag) {
ScanNavigationD($(Pages[0]).attr("class"));
}
}
});
});
$(function () {
app.run();
});
@tom-rider the problem is the app.run called without argument. The sammy app.run function accept a start_url argument to set (via the _setLocation method) the app current location before call _checkLocation method to check if url is changed... So try to change
app.run();
with
app.run('#/');
this work for me.
Follow this fiddle for a working demo and look at the console: no error!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With