View Single Post
  #4 (permalink)  
Old 06-22-09, 09:27 AM
vinpkl vinpkl is offline
Newbie Coder
 
Join Date: Oct 2008
Posts: 40
Thanks: 1
Thanked 0 Times in 0 Posts
fetch id

hi nico

thanks. it works fine but as sugested by job0107 with window.location.href.toString();

now if i need to fetch value that is not numeric,
like if i have url like
Code:
manage_products.php?choice=free
if i need to fetch value of choice that is "free" and its not numeric, then will this same function work or i need a different function for that.


vineet

Quote:
Originally Posted by Nico View Post
Code:
var url = window.href.toString();
var id  = url.match(/\?page=(\d+)/);

if (id[1])
{
    alert('The ID is: ' + id[1]);
}
else
{
    alert('No ID found');
}
... untested, but should work.
Reply With Quote