If you've found this page through a search engine, you know exactly what you're looking for so I'll get straight to the point:
String((new Date()).getTime()).replace(/\D/gi,'')
That's the quick way to automatically generate a random text string in javascript - a new string every millisecond.It's a shame that in a time of "Web 2.0" and advanced ajax-powered web interfaces we, developers, still have to deal with querky browser issues pretty much all the time - most of the in IE.
Sometimes IE caches responses in the HTTPRequest object when it shouldn't, so ajax developers frequently add random characters to the query string to get around this issue. This code helps you do just that with very little processing.
Of course, I don't want to type the same code over and over again so I took it further and turned it into a neat little function:
function rnd(){ return String((new Date()).getTime()).replace(/\D/gi,'') }...so all I have to do is...var url = '/stuff/url/?'+rnd();
// do ajax stuff...Happy javascript'ing!

