ajax方法传参数时,把两个json对象,合并成一个

xiaoxiao2021-02-28  27

调用ajax在给后台传参数的时候,如何把2个json合并成一个json:这里用到 $.extend()方法 此处引用jQuery库,请记得先加载jquery <script type="text/javascript"> var a ={"a":"1","b":"2"} var b ={"c":"3","d":"4","e":"5"} var c = $.extend({}, a,b); console.log(c);//输出结果,{"a":"1","b":"2","c":"3","d":"4","e":"5"} </script>
转载请注明原文地址: https://www.6miu.com/read-1950314.html

最新回复(0)