     e.preventDefault()
 
 
-  $(document).on "click", "a[data-ajax]", (event) ->
+  dataAjaxHandler = (event) ->
     
     event.preventDefault()
     $this = $(this)
-    $form = $this.parents("form").first()
+    $form = if $this.is("form") then $this else $this.parents("form").first()
 
     options = {}
     for action in $this.data("ajax").split(",")

      options[key] = value ? true

    ajaxOptions = 
      url : this.href
      dataType : "json"

    if options["confirm"]

      -> 
        $this.removeClass("busy")
    )

  $(document).on "click", "a[data-ajax]", dataAjaxHandler
  $(document).on "submit", "form[data-ajax]", dataAjaxHandler
  

  $(document).on "change", "table input.select-all-rows", ->
