 
   uriEncodeForm: (form) ->
     formData = ""
+    @_iterateOverFormInputs (input) =>
+      formData = @formAppend(formData, input.name, input.value)
+
+  nativeEncodeForm: (form) ->
+    formData = new FormData
+    @_iterateOverFormInputs (input) =>
+      if input.type == 'file'
+        # ???
+      else
+        formData.append(input.name, input.value)
+
+  _iterateOverFormInputs: (form, callback) ->
     inputs = form.querySelectorAll("input:not([type='reset']):not([type='button']):not([type='submit']):not([type='image']), select, textarea")
     for input in inputs
       inputEnabled = !input.disabled


      if inputEnabled && input.name
        if (radioOrCheck && input.checked) || !radioOrCheck
          formData = @formAppend(formData, input.name, input.value)

    formData

  onSuccess: (ev) ->
    @opts.success?()


  createPayload: (form) ->
    if form
      if form.querySelectorAll("[type='file'][name]").length > 0
        formData = @nativeEncodeForm(form)
      else # for much smaller payloads
        formData = @uriEncodeForm(form)
    else
      formData = ''

