我将自己的信息附加在URL中,该URL遵循2个查询参数和1个编码信息的格式。是否有任何特定模块可从查询参数获取信息,或者我可能必须使用拆分功能?
样本:?xys = 2929292&abc = 1213123&%5B%7B%22fm%22%3A%2212%22%2C%22id%22%3A%22as-as%22%2C%22pf%22%3A%7B%22nm%22 %3A%22cc%22%7D%2C%22tx%22%3A%7B%22bd%22%3A%22Hi%22%7D%2C%22ts%22%3A%221211%22%2C%22ty%22%3A %22tx%22%2C%22wanm%22%3A%2212123%22%7D%5D
我正在尝试节点服务器
样本:?xys = 2929292&abc = 1213123&%5B%7B%22fm%22%3A%2212%22%2C%22id%22%3A%22as-as%22%2C%22pf%22%3A%7B%22nm%22 %3A%22cc%22%7D%2C%22tx%22%3A%7B%22bd%22%3A%22Hi%22%7D%2C%22ts%22%3A%221211%22%2C%22ty%22%3A %22tx%22%2C%22wanm%22%3A%2212123%22%7D%5D
预期产量
xys = 2929292
abc = 1213123
message = [{“ fm”:“ 12”,“ id”:“原样”,“ pf”:{“ nm”:“ cc”},“ tx”:{“ bd”:“ Hi”}, “ ts”:“ 1211”,“ ty”:“ tx”,“ wanm”:“ 12123”}]
最佳答案
尝试使用Vanilla JS。像下面
document.location.search
关于javascript - 如何使用JS从URL获取查询参数和编码信息,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56129065/