Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is posible to submit multipart/form-data without refresh page in jQuery?

I want to upload picture from "my_form" in jQuery, I tried submit() function it alway redirect to SavePicture.jsp. Is posible to sumbit this form without refresh any page?

This is my html code

<form action="SavePicture.jsp" method="post" id="my_form" enctype="multipart/form-data">
<input name="file" type="file" id="file" size="35">
<input type="button" onClick="upload()" value="upload"></input>
</form>

And my script

function upload(){
   jQuery("form#my_form").submit();
}
like image 200
wearetherock Avatar asked Jan 20 '26 10:01

wearetherock


1 Answers

You can post to an iframe

like image 188
loraderon Avatar answered Jan 21 '26 23:01

loraderon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!