Here’s a quick and easy way to get a query string from your URL using jquery. Suppose you have the following URL: www.myurl.com?page=mypage. Use the code below to retrieve page=mypage. Of course this can be any name/value pair…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <script type="text/javascript"> function getQuerystring(key, default_){ if (default_==null) default_=""; key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regex = new RegExp("[\\?&]"+key+"=([^&#]*)"); var qs = regex.exec(window.location.href); if(qs == null) return default_; else return qs[1]; } var urlString = getQuerystring('page'); $(document).ready(function(){ if ( urlString == 'mypage' ) { //Do something with jquery here } }); </script> |
Related posts:
- Alternate Table Row Background Using JQuery Alternating your table row background color is easy to do...
- Reverse The WordPress Comments From Newest To Oldest If you want to display your comment list from newest...
- Want EDGE on your T Mobile iPhone? If you have the iPhone 3G, 3Gs or 4G, you...
- How To Remove Categories From Your URL WordPress is my favorite blogging platform but it’s not perfect...
- Key Elements of a Good Website There are several factors that go into making a successful...
nice post i am in searching of this type of query thanks for this help.
Reply To This Comment
NiCe PoSt sir can i have insert method with jQ ?! thanks in advance beautiful summer dresses
Reply To This Comment
really good information!!!
Reply To This Comment
i like your site. i hope all in person like your site.your site is very sweet.i love your site.
bd jobs
Reply To This Comment
Thank you for sharing valuable information. Nice article. I enjoyed reading this article.
part time job
Reply To This Comment
Laptop Battery High Quality Replacement HP Laptop Batteries Compaq Laptop Batteries in UK
Reply To This Comment
Good share, your topic is very great and useful for us…thank you. I just like the approach you took with this subject. It isn’t every day that you discover something so concise and enlightening.
Graphic Design Dictionary
Reply To This Comment
Its really nice article .
I will must try to follow your instruction properly. I hope your next article part-2 will published as early as possible .
Reply To This Comment
I have a url query string that was set up for us previously and i am trying to get the info that string pulls to insert in a form that I have.
Is there a simple code I can use on the registraion page to insert this info into the two fields i need it?
Reply To This Comment
I have a url query string that was set up for us previously and i am trying to get the info that string pulls to insert in a form that I have.
The URL query string is: registration?memid=300&uname=unamehere
Is there a simple code I can use on the registraion page to insert this info into the two fields i need it?
Reply To This Comment
Jon B Replied:
May 21st, 2012 at 8:49 am
What programming language is the page written in?
Reply To This Comment
Nice bit of code, helped me out on a current project, thanks!
Reply To This Comment
Jon B Replied:
March 25th, 2012 at 9:02 pm
No problem, good to hear that man.
Reply To This Comment
Pages
Recent Comments
My Instagrams
Connect With Me
Twitter
StumbleUpon
Facebook
FriendFeed
LinkedIn
RSS Feed
Check out my about.me profile!
Latest Testimonial
"Jon is very professional; quick response to all questions and emails, very clear communication, and excellent work with very quick turnaround..."
[ ...read more... ]
© 2013 » JBWEBDEV « Houston Web Design & Development
Web Links
Recent Project
www.ta7on7.com
Ways to Contact Me
Follow me on Twitter - jonxblaze
Call me directly - 832.413.2642
Go to my contact form
Drop a comment on my blog
GTalk me at jonxblaze[at]gmail