You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
We added explicit support for binary AJAX data in jquery/jquery#4150 which will ship with jQuery 4.0. But yes, for FormData specifically, you can make it work in 3.x by disabling contentType & processData options (which jQuery 4.x will do by default).
Anyhow, I am not sure if I will get around to this anytime soon, but if I find a quiet hour or so I might try to give it a go to write a starting point.
But in any case thank you for the info about the changes for 4.x regarding this. Reading the discussion there and the referenced PR made me understand this a bit better.
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
:data
parameter can be aFormData
objectcontentType
to false will in this case automatically create a correctcontentType
header including aboundary
specificationThis allowed me to solve my problem, but the documentation does not mention it and could be improved.
The text was updated successfully, but these errors were encountered: