jquery - Ajax submit multipart form without defining form fields -


i want submit form through ajax contains file input. use xmlhttprequest or iframe fallback. preferably, use plugin achieve this, however, far can see pretty plugins don't use existing forms create own, , require additional fields handset. form created framework , works, including csrf-protection example. don't want change backend, nor want hardcode fields , form properties in plugin, want tell 'here's form, handle it. , if form change (which in near future) want submit work without changing anything.

are there ways existing plugins such dropzone, jquery file upload (or iframe transport part of it) use existing forms basis? or there plugin this?

dropzone works existing forms.

<form action="/upload" class="dropzone" id="my-dropzone">     <input type="hidden" name="csrf" value="xxx" /> </form> 

dropzone automatically find form(with class dropzone) , initialize new dropzone.

from doc:

that's it. dropzone find form elements class dropzone, automatically attach it, , upload files dropped specified action attribute.

here example wrote recently:

https://github.com/wong2/doora/blob/master/templates/index.html#l66


Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -