FormData vs jQuery#serialize(), What is the difference? FormData vs jQuery#serialize(), What is the difference? ajax ajax

FormData vs jQuery#serialize(), What is the difference?


The main difference from a usage standpoint is that you can't serialize files, only file names....the value of a file input.

FormData object on the other hand also includes files if applicable.

Also serialize() will work in older browsers that don't support the FormData API for example IE < 10

reference FormData docs


One more important difference is the treatment of empty input-fields in forms.

serialize()
only contains input-fields with a value. Unchecked check-boxes or empty input-fields will be missing in the key/value pairs. Therefore the backend of your application will have to do some book-keeping in order to interpret missing keys as empty values.
FormData
will get you a complete list of all your form fields and their values. Even if they are empty.