Comment on page

Building the URL in Javascript

When necessary, modern browsers encode URLs automatically, but it is convenient to do it by code. The Javascript lines below show how to build the URL used in the previous example:
var buildURL = function(server, virtualpath, arguments) {
return server + "/" + virtualpath + "/" + encodeURIComponent(arguments.join(' '));
var baseURL = "";
var applicationPath = "TestArguments";
var arguments = ["one", "two", "three"];
var url = buildURL(baseURL, applicationPath, arguments);
Read more: