Skip to content

Documentation for ajax does not mention FormData #1234

Open
@viktordick

Description

@viktordick

It took me quite a while to find how to create an AJAX request with a fixed ordering of transferred arguments (even if the same name occurs multiple times) with a multipart/form-data encoding. I ended up posting a question to StackOverflow (https://stackoverflow.com/q/76545035/2240052) and found a related question with an answer that makes use of the following undocumented behavior of $.ajax:

  • The data parameter can be a FormData object
  • Setting contentType to false will in this case automatically create a correct contentType header including a boundary specification

This allowed me to solve my problem, but the documentation does not mention it and could be improved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions