Query-string encoding of a Javascript Object

前端 未结 30 2915
渐次进展
渐次进展 2020-11-22 00:23

Do you know a fast and simple way to encode a Javascript Object into a string that I can pass via a GET Request?

No jQuery, no

30条回答
  •  北恋
    北恋 (楼主)
    2020-11-22 00:54

    ok, it's a older post but i'm facing this problem and i have found my personal solution.. maybe can help someone else..

         function objToQueryString(obj){
            var k = Object.keys(obj);
            var s = "";
            for(var i=0;i

提交回复
热议问题