Removing %20 value from get method
13,175
just use this:
alert("dataaaaaaaaaaaa " + decodeURIComponent(list) + "llll " );
This should decode the %20
to space
look here: http://www.w3schools.com/jsref/jsref_decodeURIComponent.asp
Author by
Smitha
Tech Enthu n friendly. Love to explore new things & take up challenges and high responsibilities. SOreadytohelp
Updated on June 24, 2022Comments
-
Smitha almost 2 years
Removing %20 in get method?
var c=new Array(a); (eg: a={"1","2"}) window.location="my_details.html?"+ c + "_";
and in my_details.html :
var q=window.location.search; alert("qqqqqqqqqqqqq " + q); var arrayList = (q)? q.substring(1).split("_"):[]; var list=new Array(arrayList); alert("dataaaaaaaaaaaa " + list + "llll " );
and in "list" its dusplaying me
"1%202"
;How can I remove this
%20 =space
value ??Thanks
-
Smitha over 12 yearsthere is no space. I don't know how %20 is getting added there. I can not use POST. How can i resolve this using GET?
-
st0le over 12 years@Sneha, I'm not sure why that is, but you can use
unescape(text)
function to decode the%20
into an actual space. Hope that helps. -
Quentin over 12 yearsPlease don't link to W3Schools. They are too often wrong. (Half way down that page they forget about the "Component" part and start tossing about whole URLs instead which doesn't make for a good example and yet manages to be one of the best pages W3Schools has).
-
Quentin over 12 years
unescape
is deprecated. Don't use it. -
evildead over 12 yearsdo you have a better source than them? I actually don't find a page which has a better example.
-
Quentin over 12 yearsMDN is usually better, although in this case it is actually something of a toss up: developer.mozilla.org/en/JavaScript/Reference/Global_Objects/…
-
evildead over 12 yearsok, this is somehow just a stub. But I will take MDN in account on others post. I think for this special case w3schools fits best.
-
st0le over 12 years@Quentin, Woah! Did not know that. Thanks! :)