This question already has an answer here:
- How can I upload files asynchronously? 20 answers
I try to stop the refresh on my form when I use the change
event.
JavaScript:
$(function() {
$("input[type='file']").change(function () {
console.log("on change ok");
$("#modifier").submit(function (e) {
console.log("on submit ok");
/*
treatment
*/
e.preventDefault();
return false;
});
});
}
HTML:
<form action="" method="POST" enctype="multipart/form-data" id="modifier" >
<input type="hidden" name="action" value="test" />
<input type="file" name="upload" />
</form>
When picture is uploaded (input[type='file']
), I'd like to submit it but I don't meed to refresh my page and do some treatment.
Aucun commentaire:
Enregistrer un commentaire