• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 123
  • Last Modified:

read in parameter from URL

I have a URL like this for example:
http://mywebsite.com/test/testing/12?Id=731

What I would like to capture is the integer before the '?' in jquery so I can then display different content based on the number.
So anything between the last / and the ?


Thanks
0
Al4ddin2
Asked:
Al4ddin2
1 Solution
 
GaryCommented:
myUrl=location.href.split("?")[0].split("/")

myNumber= myUrl.pop();

Open in new window

0
 
leakim971PluritechnicianCommented:
var url = location.href;
var int = url.match(/\/(\d*)\?/).pop() * 1;

checking :
alert( int);
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now