I have a ul
with li
of images. I am taking the last li
and want to extract the image data from it to upload, other wise the server (Flask) tells me that the data is an HTMLLIElement
.
So how do I got about this? Here's the JS code:
// e.preventDefault(e);
var img = new FormData();
img.append('file',$("#preview_list li:last-child")[0]);
// Debugging statement
//$("#preview_list li:last-child").dialog();
$.ajax({
type : "POST",
url : "/_process",
data : img,
contentType: false,
dataType: false,
cache: false,
processData: false,
success: function(data,textStatus,jqXHR) {
alert(data['result']);
}
});