Search code examples
jquery-templatessammy.js

Sammy.js working fine one localhost but not when calling from remote computer


I'm working one SPA with sammy.js and jquery.tmpl.

It's kind of huge project what the company want to work as an SPA.

The issue is that there are few different states for the app (used to be three different pages and now it is all in one, add, edit and add for a non registered client).

When i am developing from my own station (IIS6.1 for windows 7, not VS IIS) and using both localhost of my IP address every thing is working great, but when trying to connect with a domain name (changes the host in my station) or from a remote computer both with ip or domain name i'm getting an 404 from sammy:

body 404 Not Found get /employer/newemployers/index.aspx#/edit/2354478  Error {message: "404 Not Found get /employer/newemployers/index.aspx#/edit/2354478 ", stack: "Error↵    at Object.n.Application.e.extend.error (…oyers/javascript/lib/jquery-1.7.2.min.js:3:17273)"} sammy-0.7.4.min.js:8

My Sammy.js code:

$.sammy('body', function () {
    this.get('#/', index);
    this.get('#/index', index); //For Non registered Employer
    this.get('#/indexPageAdd', indexPageAdd); //For Registered Employer
    this.get('#/Edit/:JobID', MainEdit); // For Job Edit
    this.get('#/firstStage', firstStage);
    this.get('#/secondStage', secondStage);
    this.get('#/thirdStage', thirdStage);
}).run('#');

Any one encountered this type or issue? Couldn't find this anywhere..

Thank you


Solution

  • Found the answer,

    When calling from my own computer( localhost or ip), Sammy.js is case insensitive, but when trying to use real urls (on my own computer or from remote computer) need to use case sensitive urls, the edit is with capital E and i used lowercase e and didn't notice.... added a record for lowercase and every thing is working great now.

    Hope this helped anyone with the same problem