Hi, you can try the following function. After putting query string name into the function, it will return the query string value.
function getQuerystring(key) {
var query = window.location.search.substring(1);
//alert(query);
var vars = query.split("&");
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
if (pair[0] == key) {
return pair[1];
}
}
}
url: '<%=ResolveUrl(string.Format("~/classifieds/details/generalDetails.aspx?productId={0}", Request.QueryString["productId"])) %> '. Try that and see.
shan000
Member
491 Points
446 Posts
how to get values from query string in jquery?
Feb 19, 2012 01:44 PM|LINK
Hi ,
how i can get the values of query string in jquery in aspx page
Thanks
Please Visit : www.classifiedspak.com
MetalAsp.Net
All-Star
112032 Points
18231 Posts
Moderator
Re: how to get values from query string in jquery?
Feb 19, 2012 01:47 PM|LINK
This plugin might help: http://code.google.com/p/m-jq-projects/wiki/rwQueryString_jQuery
shan000
Member
491 Points
446 Posts
Re: how to get values from query string in jquery?
Feb 19, 2012 02:18 PM|LINK
thanks nowusing it , im making mistake by using that plugin of comma etc here :
Please Visit : www.classifiedspak.com
MetalAsp.Net
All-Star
112032 Points
18231 Posts
Moderator
Re: how to get values from query string in jquery?
Feb 19, 2012 02:29 PM|LINK
That's a block of server-code; it's inside <% %> block. So you can use Request.QueryString["productId"], I think.
Allen Li - M...
Star
10411 Points
1196 Posts
Re: how to get values from query string in jquery?
Feb 21, 2012 01:37 AM|LINK
Hi, you can try the following function. After putting query string name into the function, it will return the query string value.
function getQuerystring(key) { var query = window.location.search.substring(1); //alert(query); var vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (pair[0] == key) { return pair[1]; } } }If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
arunabathan
Member
730 Points
236 Posts
Re: how to get values from query string in jquery?
Feb 21, 2012 04:14 AM|LINK
hi,
please refer below links,
http://collecteddotnet.wordpress.com/2011/04/28/jquery-getting-querystring-parameters-value/
http://jquery-howto.blogspot.in/2009/09/get-url-parameters-values-with-jquery.html
Thanks&Regards,
Arunabathan.G
shan000
Member
491 Points
446 Posts
Re: how to get values from query string in jquery?
Feb 24, 2012 06:39 PM|LINK
Hi , following is the code , i have link code but still unable to get that value in jquery:
Please have a look
Please Visit : www.classifiedspak.com
MetalAsp.Net
All-Star
112032 Points
18231 Posts
Moderator
Re: how to get values from query string in jquery?
Feb 24, 2012 08:29 PM|LINK
sandeepmitta...
Contributor
6767 Points
1057 Posts
Re: how to get values from query string in jquery?
Feb 25, 2012 05:21 AM|LINK
Sample code to access the value of QueryString["id"] on btn1 Click
$(document).ready(function () { $("input[id$='btn1']").click(function () { var id = <%=Request.QueryString["id"]%> alert(id); }); });Sandeep Mittal | My Blog - IT Developer Zone