Snippet: Javascript – Extend Object with toParams()

Often you need to do AJAX XHR calls, where you send information to a webserver to get information back. This snippet will extend Object with a method toParams() which will return a string ready for sending to a webserver. 1: Object.prototype.toParams=function () { 2: var sParams=”; 3: for(a in this) { 4: var val=this[a]; 5: Continue reading