Get the first part of a url path
<p>If I have a url like:</p>

<p><a href="http://localhost:53830/Organisations/1216/View" rel="nofollow">http://localhost:53830/Organisations/1216/View</a></p>

<p>I want to alert the first part of the url path in lowercase format e.g. 'organisations'</p>

<p>So far I have:</p>

<pre><code>var first = $(location).attr('pathname');

first.indexOf(1);

first.replace('/', '');

first.toLowerCase();

alert(first);
</code></pre>

<p>but it's not working as intended. Can anyone help? Thanks</p>
