I need to convert following type dictionary:
{'key1': ['value1'], 'key2': ['value1', 'value2']}
to key1=value1&key2=....
i.e. post data form. I am doing this inside chrome extention, the above dictionary of formdata is returned by:
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 remeber achieving the same using JQuery $.params() function. How can the same be done in javascript.