Groups
Groups
Sign in
Groups
Groups
forumgrouper
Conversations
About
Send feedback
Help
jQuery handling of URL params?
0 views
Skip to first unread message
Audrey A Lee
unread,
Aug 22, 2009, 6:13:22 PM
8/22/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to forumgrouper
Hello,
Rails has a hash named "params" which contains information from my
current URL.
Does jQuery have something like params?
Related question:
What is the jQuery-way of getting data out of the current URL?
-Audrey
Audrey A Lee
unread,
Aug 22, 2009, 7:42:56 PM
8/22/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to forumgrouper
not the jQuery way but terse and effective:
http://www.netlobo.com/url_query_string_javascript.html
function gup( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
//
http://www.foo.com/index.html?bob=123&frank=321&tom=213#top
// var frank_param = gup( 'frank' );
Reply all
Reply to author
Forward
0 new messages