So I'm trying to make a link where the last part of the url is a random string generated by JavaScript. The Javascript function I have been using is this:
function randomString(length, chars) {
var result = '';
for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))];
return result;
}
document.write(randomString(6, '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'));
How can I use this string inside a url, for example: <a href="http://mypage.com/random-generated-string">?