Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello
I want to pass a "Persian" string in url, but in another javascript file that I want to get that, I get a hashed string, what should I do ?

What I have tried:

To send data in url:
JavaScript
location.href = "Second.html?ID=" + _MyID + "&Text=" + _MyText;


and To Get Data
JavaScript
function processUser()
  {
    var parameters = location.search.substring(1).split("&");

    var temp = parameters[0].split("=");
    l = temp[1];
    temp = parameters[1].split("=");
    p = temp[1];
  }


instead of a "Persian" Text, I get a hashed code
Posted
Updated 30-Dec-16 23:30pm
Comments
Shahzad Mirza 31-Dec-16 2:26am    
Why you want to send data using url? why not cache or Cookies?
Ali Majed HA 31-Dec-16 2:36am    
Do you mean using window.localstorage in javascript?
Do you think it is better solution?
Shahzad Mirza 31-Dec-16 2:49am    
if you want to use persian string as a parameter i think its a better way to use without getting hash.

1 solution

Try this:
add HTML Charset[^]
<meta charset="utf-8">
to your web pages. then,
decodeURIComponent(location.search)

JavaScript decodeURIComponent() Function[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900