上传按钮触发,Ajax跨越请求
$("#uploadBtn").change(function() { if (typeof (FileReader) != "undefined") { var formdata = new FormData(); var v_this = $(this); var fileObj = v_this.get(0).files; var img = $("#imgPath"); formdata.append("imgFile", fileObj[0]); $.ajax({ url: "https://api.longqiuhong.com/upload/images", type: "POST", dataType: "JSON", async: false, data: formdata, cache: false, contentType: false, processData: false, timeout: 5000, success: function(data) { if (data.success == true) { img.attr('src', data.url); img.css('display', 'block'); $("#uploadFile").val(data.url); } else { alert("上传错误!!"); } }, error: function(XMLHttpRequest, textStatus, errorThrown) { console.log(errorThrown) } }); } });
系统已开启自动识别垃圾评论机制,识别到的自动封号,下载出错或者资源有问题请联系全栈客服QQ 1915635791