     xhr = new XMLHttpRequest
     xhr.onload = @_xhr_onload
     xhr.pwnfxOnData = onData
-    xhr.open xhrMethod, xhrUrl
-    xhr.send new FormData(xhrForm)    
+    xhr.open method, url
+    xhr.setRequestHeader 'X-Requested-With', 'XMLHttpRequest'
+    if form
+      xhr.send new FormData(form)
+    else
+      xhr.send null
   
   # Called when an XHR request issued by PwnFx.xhr works out.
   _xhr_onload: ->

      return true if value == refreshOldValue
      refreshOldValue = value
      
      return true if refreshPending
      refreshPending = true
      window.setTimeout ajaxRefresh, refreshInterval
      true
      
    element.addEventListener 'change', onChange, false
    element.addEventListener 'keydown', onChange, false
    element.addEventListener 'keyup', onChange, false
    
    
  # The closest form element wrapping a node.
  parentForm: (element) ->
    while element
      return element if element.nodeName == 'FORM'
      element = element.parentNode
    null

PwnFx.registerEffect 'refresh', PwnFxRefresh



  # @param klass the class that wraps the effect's implementation
  registerEffect: (attrPrefix, klass) ->
    if @effectsByName[attrPrefix]
      throw new Error("PwnFx effect name {attrPrefix} already registered")
    @effects.push [attrPrefix, klass]
  
  # Finds a scoping container.
