POST response from server

Good day ,

Can’t figure out the part with the callback

      webix.ajax().post("/log", params).then(function (data) {
            //this part
            alert(data.json().status);
       }

How should ‘data’ get the server response message. It just shows me that ‘json()’ property is undefined or null.

How i tried to do it :

I get values from Form , add an extra parameter then send it to the server . There check if the value match the value in databank and send a message if they match or not. ( Using NodeJS )

         if ($$("login").validate()) {
        
        var params = $$("login").getValues(); 
        params.exparam = "login"; /* extra Parameter */            
        
        webix.ajax().post("/log", params).then(function (data) {
            
            alert(data.json().status);

        }).fail(function (err) { 
            alert(err);
        });
    }           
}

Sorry , being still a beginner.

Please, try logging data to console to inspect its properties and methods.

The data.json() call will try to parse the response of server side, it may show the above error message when server side returns not-valid json

Try to add console.log(data.text()) to check the exact text of server side response, to be sure that it is a valid json.