       formData.append key, @value(key)
 
     formData
+
+  urlEncoded: (action) =>
+    parser = document.createElement('a')
+    parser.href = action
+    params = parser.search.substring(1).split('&')
+
+    for key in @keys()
+      params.push "#{key}=#{@value(key)}"
+
+    if @form?
+      for element in @form.elements
+        unless element.hasAttribute('name')
+          continue
+
+        type = element.getAttribute("type").toUpperCase() || 'TEXT'
+        if (type != 'FILE' && type != 'RADIO' && type != 'CHECKBOX') || element.checked
+          params.push "#{encodeURIComponent(element.name)}=#{encodeURIComponent(element.value)}"
+
+    parser.search = "?#{params.join("&")}"
+    parser.href
 
 class Response
   constructor: (@xhr) ->


    @method = el.getAttribute('method') || 'GET'

  send: =>
    action = @request.element.getAttribute('action') || @request.element.getAttribute('href')


      throw "Cannot send a request to the server if the element isn't a Form or if the element doesn't have the HREF attributes: <div href>"
      return


    if /post|put/i.test(@method)
      @open(@method, action)

      token = document.querySelector('meta[name=csrf-token]').getAttribute('content')
      @request.setRequestHeader 'X-CSRF-Token', token

      @request.send(@data.serialize())
    else
      action = @data.urlEncoded(action)
      @open(@method, action)
      @request.send()


ObserveJS.XHR = XHR
