When encoding a query string to be sent to a web server - when do you use escape() and when do you use encodeURI() or encodeURIComponent()
escape()
encodeURI()
encodeURIComponent()
I have this function...
var escapeURIparam = function(url) { if (encodeURIComponent) url = encodeURIComponent(url); else if (encodeURI) url = encodeURI(url); else url = escape(url); url = url.replace(/\+/g, '%2B'); // Force the replacement of "+" return url; };