I want to get the id element from the url without '?' in php
Like : 
In php get the url will be 
http://exp.com/dir/index.php?id=123 
So i tried to use javascript to get this
http://exp.com/dir/123 
My code in javascript was 
var url = document.URL;
var id = url.substring(url.lastIndexOf('/') + 1);
alert(id); 
But when i go idon't get an alret box say the 123
It says not found because the server think that i want a directory 
Can someone help with my javascript code ?
 
     
    