       root.app.delay @settings.retryDelay, => @ajax(options)
     else
       Ti.API.info('network error')
-      options.onError(@xhr.status)
+      options.onError(options.xhr.status)
     
 
     

    options = root._.extend({
      url: null
      params: {}
      method: 'POST'
      contentType: 'application/x-www-form-urlencoded'
      userID: null

    @reset(options)
    @activeRequest = options
    
    options.xhr = @xhr unless options.xhr
    
    if Ti.Platform.osname != 'iphone' || Ti.Platform.osname != 'ipad'        # CMC put this here as Android was having trouble making multiple requests with params
      options.xhr = Ti.Network.createHTTPClient({ timeout: @settings.timeout })
    
    options.xhr.open('POST', options.url) #TODO: GJ: add support for GET
    options.xhr.setRequestHeader('Content-Type', options.contentType)
    options.xhr.setRequestHeader('MyHome-UserID', options.userID) if options.userID?
    options.xhr.setRequestHeader('MyHome-Token', options.token) if options.token?
    
    options.xhr.onload = (e) ->
      @activeRequest = null
      Ti.API.info "@responseText: #{@responseText}"
      options.onSuccess(JSON.parse(@responseText))
    options.xhr.onerror = () => @onError(options)
    
    if options.contentType == 'application/json'
      options.xhr.send(JSON.stringify(options.params))
    else
      options.xhr.send(options.params)
    
  reset: (options) ->
    if @xhr.readyState not in [0,4]
