<%= file_field_tag :customer_profile, id: "customer_profile" %>
var formData = new FormData();
custProfile =$("#customer_profile")[0].files[0]
formData.append("device_img", custProfile);
$.ajax({
url: "<%= upload_image_customer_path(id: params[:id]) %>",
type: 'POST',
dataType: 'json',
data: formData,
contentType: false,
processData: false,
cache : false,
success: function(data){
if(data["msg"] == true){
alert(success)
}
},
error: function(data){
console.log(data);
}
});
var formData = new FormData();
custProfile =$("#customer_profile")[0].files[0]
formData.append("device_img", custProfile);
$.ajax({
url: "<%= upload_image_customer_path(id: params[:id]) %>",
type: 'POST',
dataType: 'json',
data: formData,
contentType: false,
processData: false,
cache : false,
success: function(data){
if(data["msg"] == true){
alert(success)
}
},
error: function(data){
console.log(data);
}
});
No comments:
Post a Comment