Encode special characters to pass in url and read by javascript

This question already has an answer here:

  • Encode URL in JavaScript? 12 answers

  • 例如,您可以尝试encodeUri内置函数

    encodeURI('coño funcionó!')
    

    Previous answer is correct. JavaScript has built in functions for fulfilling this kind of tasks.

    You can try to investigate these functions in w3schools.com. Here are the links with basic information and live "Try it out" feature:

  • encodeURI - takes string with your characters and encodes it into plausible for url style ( encoding spaces and non ANSII chars )
  • decodeURI - takes encoded string and decodes it to initial state
  • 链接地址: http://www.djcxy.com/p/26528.html

    上一篇: 如何使用Javascript ajax发送网址?

    下一篇: 编码特殊字符以传入url并通过javascript读取