millermedeiros / crossroads.js

JavaScript Routes
http://millermedeiros.github.com/crossroads.js/
1.44k stars 156 forks source link

Crossroads - 404 on route #159

Open virtapoika opened 7 years ago

virtapoika commented 7 years ago

Hi! I'm trying to start using crossroads. I've managed to get "/" route working but for some reason others (/account) wont work. Could you help a noobie out of this? `

  var defaultRoute = crossroads.addRoute("/", function () {

    $("#root").load("main.html");

  });

  var accountRoute = crossroads.addRoute("account", function () {

    $("#root").load("account.html");

  });
  crossroads.parse(document.location.pathname);

`

I'm getting on url localhost:8000/ all working as I want to but on localhost:8000/account it gives 404... :(

Standa666 commented 4 years ago

Have you checked what comes into parse method from document.location.pathname. Your root is equivalent to / so your path should also start with slash. Try /acount.