escaping text input for urls in javascript

If you need to make sure that some text entered into a text field can be sent as part of a uri, say in an ajax call as a parameter, then the built in javascript function encodeURIComponent() seems to work well.

Reference here.

Leave a Reply