var s = "asfg/hjl/qwet";
alert(s.substring(0, s.indexOf("/")));