Golang杜松子酒处理AJAX请求

Send from frontend part ajax request to golang server

Example of ajax request:

    var sendAjax = function (method, url, body) {
    var xmlhttp = new XMLHttpRequest();

    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState === XMLHttpRequest.DONE ) {
            if (xmlhttp.status === 200) {
                console.log('success');
            } else if (xmlhttp.status === 400) {
                alert('There was an error 400');
            } else {
                alert('something else other than 200 was returned');
            }
        }
    };

    xmlhttp.open(method, url, true);
    xmlhttp.send(JSON.stringify({'b44': 'sdfsdfsdfs}));
};

Golang side

    router.POST("/save", func(context *gin.Context) {
    if err := context.Request.ParseForm(); err != nil {
        fmt.Println("Cannot ParseForm. Error:", err)
    }

    var b64FromRequest string = context.Request.FormValue("b44") //null here :(

Could anyone help me with this issue?

Instead of context.Request.FormValue("b44") try context.PostForm("b44")