tags:

views:

26

answers:

1

Hi i am using this code to get this path : http://192.168.1.5:83/staging/eleave/application/view/leave_approval.php

var url = document.location.toString();

Question is how to get this path only? : http://192.168.1.5:83/staging/eleave/application/

A: 

If you know how many folders you need in the url then:

var splittedUrl = url.split("/");
var depth = 5;
var neededUrl = '';
for (i = 0; i < depth; i++)
{
   neededUrl += splittedUrl[i] + '/';
}
Zsolti
thanks this i what i looking for.
cyberfly