为什么直接跳过ajax不执行?

 reader.onload = function (e) {
                var canvas = document.createElement("canvas");
                var ctx = canvas.getContext("2d");
                var image = new Image();
                image.src = this.result;
                image.onload = function () {
                    var cw = image.width;
                    var ch = image.height;
                    var w = image.width;
                    var h = image.height;
                    canvas.width = w;
                    canvas.height = h;
                    if (cw > 1200 && cw > ch) {
                        w = 1200;
                        h = (1200 * ch) / cw;
                        canvas.width = w;
                        canvas.height = h;
                    }
                    if (ch > 800 && ch > cw) {
                        h = 800;
                        w = (800 * cw) / ch;
                        canvas.width = w;
                        canvas.height = h;
                    }
                    $.ajax({
                        url: 'http://17hr.net:84/Api/FaceTest.ashx',
                        'data': JSON.stringify({ type: 0, photo: image.src }),
                        'type': 'POST',
                        'processData': false,
                        'contentType': false,
                        'contentType': 'application/json',
                        success: function (ret) {
                            var obj = JSON.parse(ret);
                            if (obj.result == 0) {
                                if (obj.photo != "") {
                                    $("#oldimg").attr("src", obj.photo);
                                };
                                if (obj.resultphoto != "") {
                                    $("#head-img1").attr("src", obj.resultphoto);
                                };
                            }
                        },
                    });
  showLoading("人脸上传中..", "div");
                    mui.post("/FkDj/GetRenLianShangChuan", { Gonghao: Gonghao, dataURL: dataURL, enterId: enterId }, function (ret) {
                        hideLoading(function () { mui.alert(ret.msg, function () { location.reload(true); }) });

                    })
                }
            }
        }

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 以帮助更多的人 ^-^