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

php - trouble displaying mysqli database results in correct order -

depending on nth recurrence of job in control M -

sql server - Cannot query correctly (MSSQL - PHP - JSON) -