Luc Rooijakkers
Luc Rooijakkers

Reputation: 41

Is there a plugin to get jQuery.ajax to submit multipart/form-data?

I need this so I can submit a subset of form controls that contain non-ASCII text.

The solution with an iframe element won't work for me because it submits the entire form; I only want to submit a subset of the controls.

I know that I can build a multipart/form-data string myself, but it seems that this must have been done before...

Upvotes: 4

Views: 5253

Answers (2)

B Robster
B Robster

Reputation: 42003

Update: As of version 3.02 (which came out early 2012), the jquery.form plugin now handles ajax file submits much more friendlierly. Check it.

Upvotes: 0

Gabriel Hurley
Gabriel Hurley

Reputation: 40052

I would recommend using jQuery and the Form plugin: http://malsup.com/jquery/form/#api

You can use the fieldSerialize() method to submit only a subset of the form and iframe:true option to make it work with submitting files, etc.

Hope that works for you!

Upvotes: 3

Related Questions