Skip to content
Advertisement

FormData is empty when using jQuery ajax()

I try to submit form with file with jQuery.ajax. Google says I should use FormData which will automagically encode the file and all inputs into the one object which I can send via XHR.

Well, the FormData object is empty. It’s empty in the debugger and on the server side. I can’t find the error. Here is the code. The browser is Firefox 27.

JavaScript

In Firebug on the Network tab in the Params section I see the line:

enter image description here

[object FormData]: "undefined"? Seriously?

The silly thing that I can’t even send FormData object created from scratch. Like this

JavaScript

Advertisement

Answer

Turned out, I’m using jQuery 1.8.1 which doesn’t support FormData. Library update solved the problem.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement