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
My ES6 version (pure Javascript, no jQuery):
function toQueryString(paramsObject) { return Object .keys(paramsObject) .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(paramsObject[key])}`) .join('&') ; }