This is a general question about using Ajax on data that is not text/string.
Is it possible to do a JQuery Ajax POST request with a selected image in a form? This is to preview a processed image, taken from form input, before submit. The image is posted to a server doing some image processing and will return the img html.
For example:
var img = $('#form').find('input:first, select:first').first(); // the image/file input
$.ajax({
type: "POST",
url: "photoprocess.php",
data: "{prephoto: '" + img+ "'}", // ??
contentType: "application/jpeg; charset=utf-8",
dataType: "text",
success: function (response) {
var imgHtml = response.d;
$('#preview').empty();
$('#preview').append(""+imgHtml);
},
......
If a plugin is required, which one should I go for? Or better phrased: is there a plugin which you have good experience with for this solution?
Cheers.