首页 > 代码库 > JS uploadPropic

JS uploadPropic

function uploadPropic(file) {
        $.ajaxFileUpload({
            url: "/InFo/Uploadpropic",
            secureuri: false,
            datatype: JSON,
            fileElementId: file.id,
            success: function (data, status) {
                var json = jQuery.parseJSON(jQuery(data).text());
                if (json.result == "1") {
                    document.getElementById("proImg").src =http://www.mamicode.com/ json.path;
                    document.getElementById("ImageID").value =http://www.mamicode.com/ json.path;
                    alert("尊敬的伙伴,“e挖小蜜蜂”提醒您:" + json.msg);
                }
                else {
                    alert("尊敬的伙伴,“e挖小蜜蜂”提醒您:" + json.msg);
                }

            },
            error: function (data, status, e) {
                alert("尊敬的伙伴,“e挖小蜜蜂”提醒您:上传失败");
            }
        });
    }

 

JS uploadPropic