giammin

Encode URI

Jan 2nd, 2013
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // encodeURI(uri) encodes special characters, except: , / ? : @ & = + $ # (Use encodeURIComponent() to encode these characters).
  2.  
  3. var myUrl="my test.asp?name=ståle&car=saab";
  4. var uriComponent = encodeURIComponent(myUrl);
  5. console.log(uriComponent );
  6. var uri = encodeURI(myUrl);
  7. console.log(uri);
Advertisement
Add Comment
Please, Sign In to add comment