window.location.url Javascript
<p>I'm splitting the current url into pieces but I'm doing something wrong with this part to get the current url. How can I solve this?</p>

<pre><code>var url = window.location.url; 
</code></pre>

<p>I'm trying to get the current url from the page. This is my function</p>

<pre><code>function split(){

    var url = window.location.url;     // This part is not correct
    var firstSplit = url.split('?')[1];

    var name = firstSplit.split('&amp;')[0];
    var age = firstSplit.split('&amp;')[1];

    var parName = name.split('=')[0];
    var nameName = name.split('=')[1];

    var parAge = age.split('=')[0];
    var ageAge = age.split('=')[1];

    document.getElementById("nameId").innerHTML=naamName;
    document.getElementById("ageId").innerHTML=leeftijdAge;
}
</code></pre>
