Solved

read in parameter from URL

Posted on 2014-09-24
2
89 Views
Last Modified: 2014-09-25
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
Comment
Question by:Al4ddin2
2 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40341672
myUrl=location.href.split("?")[0].split("/")

myNumber= myUrl.pop();

Open in new window

0
 
LVL 82

Expert Comment

by:leakim971
ID: 40341673
var url = location.href;
var int = url.match(/\/(\d*)\?/).pop() * 1;

checking :
alert( int);
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now