escape はクエリパラメータのエスケープに使ってはいけない

コメントしたけど間違えている人も多そうなので書いておく。
escape は「+」をパーセントエンコーディングしてくれないので、クエリパラメータのエンコードに使うと受け取ったサーバ側で空白になってしまうというオチが待っている。

escape("+=&"); // => "+%3D%26"
% php -r 'var_dump(urldecode("+%3D%26"));'
string(3) " =&"

Mozilla のドキュメントを見ると、そもそも URI 用のエスケープ関数だとは書いてなかったりする。

The escape and unescape functions let you encode and decode strings. The escape function returns the hexadecimal encoding of an argument in the ISO Latin character set. The unescape function returns the ASCII string for the specified hexadecimal encoding value.

The escape and unescape functions do not work properly for non-ASCII characters and have been deprecated. In JavaScript 1.5 and later, use encodeURI, decodeURI, encodeURIComponent, and decodeURIComponent.

ということで、encodeURI/encodeURIComponent の方を使いましょう。クエリパラメータなら encodeURIComponent の方ね。
まぁ、SAJAX なんかは escape を使っちゃってたりするんだけどね。