javascript - encode URL so it can be send through GET -


what best way attach url query string in javascript? realize needs encoded.

i've come across encodeuricomponent() function, looks thing want. unsure if suitable kind of task.

example usage:

var someurl = encodeuricomponent("http://stackoverflow.com/questions/ask?name=.hil#");  var firsturl = "www.stackoverflow.com/questions?someurl="  firsturl+someurl; 

your choices encodeuri , encodeuricomponent. encodeuricomponent right choice because encoding part of url (which happens url-like doesn't matter here). if use encodeuri, not convert enough of characters in component.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -