The background parameter for passing parameters in vue.js ajax is not application/x-www-form-urlencoded MIME.

< H2 > post request filter encodeURI not resolved! Using contentType will not help. < / H2 >

help:
https://blog.csdn.net/justlov.

Test environment 1:ajax with parameter request: name
google
get/post unchanged
foreground: pass name directly (the value can be obtained)
background: the decoding / puzzle effect is consistent
when the parameter name value is requested to the background through the browser ajax request, it is not
application/x-www-form-urlencoded MIME value

< H2 > the effect is consistent with the coding < / H2 >

the request request value for the browser is application/x-www-form-urlencoded MIME
request 200

personal consideration: inconsistent coding between foreground and background

Front end:

data() {
    var name=this.$route.query.name;
        $.ajax({
            url : "topInfo?name="+name,
            contentType: "application/json; charset=utf-8",
            type : "POST", //GET
            async : false, //false,
            //timeout : 5000, //
            dataType : "json", //:
            success : function(data) {
                this.items = data.data;
            },
            error : function(data) {
                alert("!!");
            }
        })
        debugger;
    return {
        items
    }
},

background:

public void moreList() throws Exception
{
    if("".equals(name)||name==null){
        SessionUtils.outRightJSon(this.response,"--null--");
    } else if(name.equals("%E5%91%A8%E8%80%81%E5%B8%88")){
        SessionUtils.outRightJSon(this.response,"----");
    }
    //URLDecoder.decode(name,"UTF-8")
    request.setCharacterEncoding("utf-8");
    ContentVO listContentVo = topServiceImpl.more(name,5);
    SessionUtils.outRightJSon(this.response, listContentVo);
}
Jun.30,2021

this is obviously url encoded at the front end and decoded at the back end.

but the rules of front and back end encoding and decoding may not be unified, if there are no special characters, it is OK not to encode them.

besides, didn't you say post request? It's not in the screenshot.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34fb7-2bf3d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34fb7-2bf3d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?