I'm having an issue trying to get data from an ajax query in my flask project. The server receives a "NoneType".
Here is my ajax query:
function doChart(val){
    console.log(val);
    $.ajax({    
            url : baseURL + '/get-stat-data',
            dataType: 'json',
        data: JSON.stringify({
              item: val
            }),
            type : "POST",
        success:function(data){
            //alert(data.substr(1, data.length - 2));
            alert(data);      
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) { 
            alert("Status: " + textStatus+", Error: " + errorThrown);  
        } 
    });
}
Flask code :
@application.route("/get-stat-data",methods=['GET', 'POST'])
def get_stat_data():
    if request.method == "POST":
        json = request.json
        #con = connect_db()
        print("data = "+json)
Error I get :
print("data = "+json)
TypeError: Can't convert 'NoneType' object to str implicitly
Thank you for your help
 
    