close
今天我想把object變成url
Object
let inputs = {
name: kai,
ID: 12,
}
Str
name=kai&ID=12
let str = Object.keys(inputs).map(function(e){
return encodeURLComponent(e) + "=" + encodeURIComponent(inputs[e]);
}).join("&");
The encodeURI() function is used to encode a URI.
This function encodes special characters, except: , / ? : @ & = + $ # (Use encodeURIComponent() to encode these characters).
文章標籤
全站熱搜
留言列表