About Ajax and function closure problem

About Ajax and function closure problem

Hi:

I have a problem about the ajax and function closure.
The following is my code snippets.
  1.  var Handler = function (size, cur) {
                        return $.ajax({
                            type: 'POST',
                            dataType: "json", //for post method
                            url: './Demo.aspx/Demo',
                            contentType: 'application/json; charset=utf-8',
                            data: JSON.stringify({ p1: size, p2: cur }),
                            error: function (error) {
                                console.log(error);
                            }
                        });
                    }

    $.when(Handler(6, 1)).done(function (data) {
        var cs = JSON.parse(data.d);
    }
The problem is $.when is not working, and data in function(data) is undefined, but, if I just use $.then,
 it work well, just like following:
  1. Handler(6, 1).then(function (data) {
        var cs = JSON.parse(data.d);
    }
This is very strange, is there any reason for that. My jQuery version is 1.12.  Thanks a lot.