Ajax请求返回失败

I have written a small script to make an Ajax request. I use jQuery for this purpose. I have done this several times but this is the first time I get a failure message. This is my script:

$(document).ready(function(){
    $("#btnExecute").click(function(){
        var numberOfClusters = $('#inputNumCab').val();
        alert(numberOfClusters);
        $.ajax({
            type: "POST",
            url: 'RunPythonThroughPHP/insertData_2.php',
            //data: { numberOfClusters: numberOfClusters },
            success: function(msg){
                alert('thanks');
            },
            error: function(){
                alert("failure");
            }
       });
    });
});

The concept is the following. When I press the button (which is in a form) I get the value of a text field (based on id) and I pass this data into my ajax request. The problem is I get the failure alert. Why this happens? If I make my request not async (async: false) then it works.