Ali Gajani
Ali Gajani

Reputation: 15091

How do I append a baseurl to this in JSON?

window.location = "../employer/dashboard"

Need to append a base url so I wont have to add ../

Upvotes: 0

Views: 113

Answers (2)

Chris Gessler
Chris Gessler

Reputation: 23113

This might do the trick (untested), but seems easy enough.

var root = location.protocol + "://" + location.host + ":" + location.port;

Upvotes: 0

Joseph
Joseph

Reputation: 119847

you might wanna check window.location and all it's properties, especially window.location.hostname

Upvotes: 1

Related Questions