jquery Ajax 实现图片上传的功能。

$('#image').on('change', function () {
        var url = "";
        var form = new FormData();
        form.append("file", this.files[0]);
        var settings = {
            "url": url,
            "method": "POST",
            "timeout": 0,
            "headers": {
                deviceType:"5",
                deviceId:md5("navigator.userAgent")
            },
            "processData": false,
            "mimeType": "multipart/form-data",
            "contentType": false,
            "data": form
        };
        $.ajax(settings).done(function (response) {
            console.log(response);
        });
    })

  

上一篇:python 基础学习1


下一篇:openstack学习-创建一台云主机(七)