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

Share:
13,175
Smitha
Author by

Smitha

Tech Enthu n friendly. Love to explore new things & take up challenges and high responsibilities. SOreadytohelp

Updated on June 24, 2022

Comments

  • Smitha
    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
    Smitha over 12 years
    there 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
    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
    Quentin over 12 years
    Please 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
    Quentin over 12 years
    unescape is deprecated. Don't use it.
  • evildead
    evildead over 12 years
    do you have a better source than them? I actually don't find a page which has a better example.
  • Quentin
    Quentin over 12 years
    MDN is usually better, although in this case it is actually something of a toss up: developer.mozilla.org/en/JavaScript/Reference/Global_Objects‌​/…
  • evildead
    evildead over 12 years
    ok, 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
    st0le over 12 years
    @Quentin, Woah! Did not know that. Thanks! :)