javascript - post method parameters are converted into parameters spliced ​​on the url by the get method
黄舟
黄舟 2017-05-19 10:47:42
0
1
882
var param = {
        "regionCodes": "110000,120000,13000",
        "purchaseGroups": "A01,A02",
        "feedBackType": "0",
        "isReplied": "0",
        "bTime": "20170301",
        "eTime": "20170431",
        "page": 0,
        "size": 20
    }

It turns out that the post method can pass parameters directly. Now we use the get method first, so we need to splice the parameters after the url.
Similar form:

/ask?regionCodes=110000,120000,13000&purchaseGroups=A01,A02&feedBackType='0'
...

Write a function but it cannot meet the requirements (cannot handle commas)

function changeParam(param){
        return JSON.stringify(param).replace(/:/g,'=').replace(/,/g,'&').replace(/{/g,'?').replace(/}/g,'').replace(/"/g,'');
    }
求一个函数完美转换的函数
黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(1)
巴扎黑

http://stackoverflow.com/ques...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template