0

I have a problem, I wonder if someone could help me, I need to pass a string that contains (&) via get. Example:

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

This way the name arrives from the other sides only AA

Jerfeson Guerreiro
  • 745
  • 1
  • 10
  • 19
  • Try this: var url = 'com/index.php?name=' + encodeURIComponent('AA&BB') + '&age=18&city=....'; – Alfredo Costa Mar 09 '17 at 20:49
  • 1
    Solution: http://stackoverflow.com/questions/16622504/escaping-ampersand-in-url https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent – Jerfeson Guerreiro Mar 09 '17 at 20:50

1 Answers1

1

You have to encode the parameter before sending it to the server:

var url = "normal url?" + encodeURIComponent("get params");
DZDomi
  • 1,685
  • 15
  • 13