Open ali-master opened 6 years ago
Hi,
let formData = Object.keys(data).reduce((encoded, key) => { const encKey = encodeURIComponent(key); const encData = encodeURIComponent(data[key]); return `${encoded}&${encKey}=${encData}` }, '');
Then:
let data = {a: "1", b: "2"} // result of formData: &a=1&b=2
So we should be replaced first & with an empty string, while we can create an array of keys and join them together with &.
Hi,
Then:
So we should be replaced first & with an empty string, while we can create an array of keys and join them together with &.