       @parentElt = document.getElementById @config.parentElt if @config.parentElt
       @_addEventHandlers()
       @results = @_buildResults()
+      @xhr = @_setupXHR()
 
     _updateConfig: (args) ->
       newConfig = {}


    _searchFor: (searchTerm) ->
      if searchTerm?.length >= @config.threshold
        @_makeRequest searchTerm
      else if @results.displayed
        @_removeResults()

    _makeRequest: (searchTerm) ->
      myRequest = new XMLHttpRequest()
      myRequest.addEventListener 'readystatechange', =>
        if myRequest.readyState == 4
          if myRequest.status == 200
            @_populateResults JSON.parse(myRequest.responseText), searchTerm

      myRequest.open 'get', @_generateURI(searchTerm, @config.scope)
      myRequest.setRequestHeader 'Accept', '*/*'
      myRequest.send()

    _generateURI: (searchTerm, scope) ->
      uri = "#{@config.uri}#{searchTerm}"

      resultItemClass: 'autocomplete__result',
      resultLinkClass: 'autocomplete__result__link',
      resultItemHoveredClass: 'autocomplete__current',
      activeClass: 'autocomplete__active',
      throttle: 200
      map:
        title: 'title',
        type: 'type',
