$("#datatable").on("change",'input[type=file]',function() {
var formdata = new FormData();
var v_this = $(this);
var fileObj = v_this.get(0).files;
url = "..";
formdata.append("brand_img", fileObj[0]);
formdata.append("id", $(this).attr("data-id"));
jQuery.ajax({
url : url,
type : 'post',
data : formdata,
cache : false,
contentType : false,
processData : false,
dataType : "json",
success : function(data) {
//yourcode..
}
});
return false;
});
网友评论