-3

I am passing data between ajax communications and it is basically a chat message. What I would like to know is how to prepare the data using javascript for transfer to the backend. They might post links and characters.

Something like urlEncode?

somejkuser
  • 8,856
  • 20
  • 64
  • 130

1 Answers1

0

encodeURIComponent would be the right method to prepare it for transfer via HTTP.

For further description of the method, see f.e. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent

CBroe
  • 91,630
  • 14
  • 92
  • 150