crossroads.js icon indicating copy to clipboard operation
crossroads.js copied to clipboard

Crossroads - 404 on route

Open virtapoika opened this issue 7 years ago • 1 comments

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... :(

virtapoika avatar Mar 06 '17 23:03 virtapoika

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.

Standa666 avatar Nov 04 '19 08:11 Standa666