So I have a form and I\'m submitting the form through ajax using jquery serialization function
serialized = $(Forms).serialize();
$.ajax({
hmmmm i think there is much efficient way to make it specially for people want to target all browser and not only FormData supported browser
the idea to have hidden IFRAME on page and making normal submit for the From inside IFrame example
most important to make a target of form the hidden iframe ID or name and enctype multipart/form-data to allow accepting photos
javascript side
function getFrameByName(name) {
for (var i = 0; i < frames.length; i++)
if (frames[i].name == name)
return frames[i];
return null;
}
function uploadDone(name) {
var frame = getFrameByName(name);
if (frame) {
ret = frame.document.getElementsByTagName("body")[0].innerHTML;
if (ret.length) {
var json = JSON.parse(ret);
// do what ever you want
}
}
}
server Side Example PHP