I have a javascript object that I need to flatten into a string so that I can pass as querystring, how would I do that? i.e:
{ cost: 12345, insertBy: \'testUse
General JavaScript:
function toParam(obj) { var str = ""; var seperator = ""; for (key in obj) { str += seperator; str += enncodeURIComponent(key) + "=" + encodeURIComponent(obj[key]); seperator = "&"; } return str; } toParam({ cost: 12345, insertBy: 'testUser' }) "cost=12345&insertBy=testUser"