 
   setupAJAX: ->
     el = $('<div id="loading"></div>').prependTo($('body')).hide()
-    el.ajaxSend( (e, xhr, options) ->
+    $(document).ajaxSend( (e, xhr, options) ->
       return unless options.url.match(Spine.Model.host)
       el.show()
     ).ajaxStop( =>

    dfd = jQuery.Deferred()
    options.success = (data) ->
      # console.log "forge ajax resolve", data
      dfd.resolve data

    options.error = (error) ->

      error.responseText = error.content
      error.statusText = error.message
      error.status = parseInt(error.statusCode)

      $(document).trigger 'ajaxStop', [null, options]

      # arguments: event, xhr, ajaxSettings, thrownError
      dfd.reject error
      $(document).trigger 'ajaxError', error

    $(document).trigger 'ajaxSend', [null, options]
    forge.ajax options
    dfd.promise()

