Dmitry Dmitry - 1 year ago 69
Javascript Question

How to prepare encoded POST data on javascript?

I need to send data by POST method.

For example, I have she string "bla&bla&bla". I tried use

and got "bla&bla&bla" as result. I need to replace "&" by something correct on this exaple.

What kind of method should I call to prepare correct POST data?


I need to convert only charachters which may broke POST request. Only them.

Answer Source
>>> encodeURI("bla&bla&bla")


>>> encodeURIComponent("bla&bla&bla")

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download