encodeURIComponent()
I just stumbled across this post from the Red Balloon guys, which reminded me that I wanted to blog about this great little resource about the subtle differences of URL encoding and JavaScript.
The bottom line of this article is that 9 times out of 10 you’ll want to be using encodeURIComponent() to encode vars that are to be passed as part of a URL instead of the escape() method.