html - Javascript : How can I enter a '@' in an url? -


i got code let me change value in page using form submit in javascript, problem url not accept value @ (@ = %40 in url)

here code:

index.html

<form method="get" action="page.html">   <input type="text" id="my_text" name="my_text" />   <input type="submit" /> </form> 

page.html

<input id="title"></input>  <script type="text/javascript">   function geturlvars() {     var vars = {};     var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,            function(m,key,value) {       vars[key] = value;     });     return vars;   }   document.getelementbyid("title").value = geturlvars()["my_text"]; </script> 

how can fix problem?

you want use encodeuri(), see this answer in depth explanation.


Comments

Popular posts from this blog

What Are The Best Universities In The World?

Hard vs. Soft Water: What's The Difference?

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -