如何在javascript中通过get传递字符串(&via)

如何在javascript中通过get传递字符串(&via),javascript,jquery,Javascript,Jquery,我有一个问题,我想知道是否有人可以帮助我,我需要传递一个包含&via get的字符串。例如: .com/index.php?nome=name=AA&BB&age=18&city= 通过这种方式,名称仅从另一侧到达AA您必须在将参数发送到服务器之前对其进行编码: var url = "normal url?" + encodeURIComponent("get params"); 试试这个:var url='com/index.php?name='+encodeURIComponent'AA&

我有一个问题,我想知道是否有人可以帮助我,我需要传递一个包含&via get的字符串。例如:

.com/index.php?nome=name=AA&BB&age=18&city=


通过这种方式,名称仅从另一侧到达AA

您必须在将参数发送到服务器之前对其进行编码:

var url = "normal url?" + encodeURIComponent("get params");

试试这个:var url='com/index.php?name='+encodeURIComponent'AA&BB'+'&age=18&city=..';解决方案: