Information Systems



How do you properly encode an ampersand in a url with javascript?

The problem is that the ampersand will improperly delimit the url fields within a "get" request.

The method is "replace." The regular expression syntax is a little weird, but the following works.

url = url.replace(/&/, "&apm;")