javascript - Same URL - render different pages (EXPRESS) -


is possible render different pages same url in express?

for example, if click on #login1, want sent /login_page/. if click on #login2, should still sent /login_page/. each time, want render different htmls depending on #login clicked.

so want this.

client:

    $("#login1").click(function(){     window.open(/login_page/,'_parent');         });      $("#login2").click(function(){     window.open(/login_page/,'_parent');         }); 

server:

    app.get('/login_page/', users.login_page1); //if clicked #login1     app.get('/login_page/', users.login_page2); //if clicked #login2 

thanks lot help.

basically need field in request convey information.

  • the simple thing: url, web designed
  • if you're cool have urls different, can use query string
    • window.open('/login_page?from=login2', '_parent');
  • if you're cool query string, set cookie
  • if you're cool cookie, request page via ajax xhr.setrequestheader
  • if you're tool cool custom ajax request header, add image tracking pixel src attribute dom prior loading login_page , detect in server side session , render different page accordingly

so in summary there @ least half-dozen ways technically achieve this. url , query string reasonable, imho.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -