I am using the new HTML5 FormData-Object to publish some values ββand images via Ajax. While this is working. Now I want to publish the array using this object, but all I got on the server side is "[object-object]". How to send an array using formdata?
What i still have
var formData=new FormData(); formData.append('text', $('#text').attr('value')); formData.append('headline',$('#headline').attr('value')); formData.append('myarray',{key1: 'bla', key2: 'blubb'});
The last line does not work. I am sending a request using this code
$.ajax({ url: 'xyz', data: formData, type: 'POST', processData: false, contentType: false, success: function(data) { var decoded=$.parseJSON(data); displaySuccess('Success', decoded.message); },error: function(data){ var decoded=$.parseJSON(data); displayError('Error', decoded.message); },complete: function(data){ $('#cursor').hide(); $("#submitbutton").removeAttr('disabled') } });
Thanks in advance.
jquery arrays post html5 image
Rainer sauerstoff
source share