Solution to the problem of random code from struts + Ajax + JSP request to the background

Time:2021-7-24

Encodeuri () transcodes the parameters before Ajax requests the URL.

For example:

Copy codeThe code is as follows:
var fileName=document.getElementById(“filePath”).value;
if(null!=fileName){
//alert(fileName);
//Transcoding, otherwise the background will be garbled
fileName=encodeURI(fileName);

… Ajax code

}