Introduction:
Here I will explain how to send ampersand in querystring value in JavaScript using asp.net or passing ampersand in query string JavaScript or jQuery.
Description:
In previous articles I explained jQuery check if string contains special characters or not, jQuery hide or show password characters, jQuery expand textbox on focus, jQuery disable right click on image and many articles related to jQuery, JavaScript. Now I will explain how to send ampersand value in querystring using JavaScript in asp.net.
In previous articles I explained jQuery check if string contains special characters or not, jQuery hide or show password characters, jQuery expand textbox on focus, jQuery disable right click on image and many articles related to jQuery, JavaScript. Now I will explain how to send ampersand value in querystring using JavaScript in asp.net.
Generally
ampersand ‘&’ will work as
separator between value pairs like as shown below
http://aspdotnet-suresh.com?name=srvinfo&userid=231
|
Here
if name contains ampersand & like “S&R
Info” we need to encode & as
%26 or we can pass url parameter
with Server.UrlEncode() like as
shown below
<script type="text/javascript">
var str = "http://aspdotnet-suresh.com?name=
Server.UrlEncode(S&R Info)&userid=231"
</script>
OR
<script type="text/javascript">
var str = "http://aspdotnet-suresh.com?name=
S%26R Info&userid=231"
</script>
|
I
hope it helps you….Happy coding
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
5 comments :
Nice Trick Sir... Thank u
nice..its very help for me..
very helpfull!!!!!!!!!
fdgdgfdgfdgf
how to retrieve this value?
Note: Only a member of this blog may post a comment.