js对象格式化为表单数据

Posted 阿臻

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了js对象格式化为表单数据相关的知识,希望对你有一定的参考价值。

只适用于 简单的数据转换

function (data) {
              // Do whatever you want to transform the data
              let ret = ‘‘
              for (let it in data) {
                ret += encodeURIComponent(it) + ‘=‘ + encodeURIComponent(data[it]) + ‘&‘
              }
              return ret
 }

以上是关于js对象格式化为表单数据的主要内容,如果未能解决你的问题,请参考以下文章