I need to convert the following type of dictionary:
{'key1': ['value1'], 'key2': ['value1', 'value2']}
to key1=value1&key2=....
i.e. mail data form. I do this inside chrome extention, the above formdata dictionary is returned:
chrome.webRequest.onBeforeRequest.addListener(function(details) { if(details.method=="POST") // ajax call { message.postdata = details.requestBody.formData; } return {requestHeaders: details.requestHeaders}; }, {urls: ["<all_urls>"],types: ["main_frame", "sub_frame"]}, ["blocking", "requestBody"]);
I remember the same thing using the jQuery $ .params () function. How can this be done in javascript.
source share