例如:
data: {
openid:'a',
name:'b',
},
转换成:openid=a&name=b
(即'content-type': 'application/x-www-form-urlencoded'形式)
方法:
convertIt(obj)
{
var str = [];
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
str.push(encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]))
//console.log(key + " -> " + obj[key]);
}
}
return str.join("&");
},