Home >Web Front-end >JS Tutorial >jquery ajax escapes special characters to prevent js injection usage example_jquery
When using ajax to leave a message, a problem occurred. Because after the message content is written, the content is submitted through ajax, and js is used to add the content of the message to the page. When browsing the message, the request is also made through ajax, and then Then display. In this way, if someone writes a js statement in the message, these statements will be executed. The solution is to escape these special characters and then display them. If you use jstl tags in jsp, it is very simple. . Just use