function upload_image_ajax() {
var form_data = new FormData(); // Creating object of FormData class
var file_data = $('#news_feed_img').prop("files")[0]; // Getting the properties of file from file field
form_data.append("file", file_data) // Appending parameter named file with properties of file_field to
form_data.append('newsfeed_id', '1');
form_data.append('action', 'delete');
$.ajax({
url: "method/someclass.php",
type: "post",
dataType: 'text',
processData: false,
contentType: false,
data: form_data,
success: function (text) {
if (text == "success") {
return true;
} else {
alert("Something Went Wrong Please Try Again");
return true;
}
},
error: function () {
alert("An error occured, please try again.");
}
});
}
Upload Images With data Using Ajax
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment