How would you send a FormData object using amplifyjs?

124 views
Skip to first unread message

Henry H

unread,
Sep 19, 2013, 11:25:05 PM9/19/13
to ampl...@googlegroups.com
I've defined my amplify request without issue, but I cannot seem to figure out how to submit the request with a FormData object.  

Here's my definition:
amplify.request.define("submit-audio", "ajax", {
url : "/sopranos/submit_audio_to_api",
dataType : "json",
type : "POST"
});

Here's my submission:

var formData = new FormData();
formData.append('service', selected_service);
...
formData.append('db_coll', "only_recording");
amplify.request("submit-audio", formData, function(data) {
  console.log(data);
  return;
}

I get the following error:
  1. Uncaught TypeError: Illegal invocation jquery.js?body=1:7500
    1. jQuery.extend.ajaxjquery.js?body=1:8022
    2. (anonymous function)amplify.js?body=1:578
    3. amplify.requestamplify.js?body=1:486
    4. reader.onloadend

Any help would be appreciated!

Thanks,
Henry
Reply all
Reply to author
Forward
0 new messages