   id = feature.properties.id
   mqurl = "http://open.mapquestapi.com/nominatim/v1/reverse?format=json&osm_type=#{type}@osm_id=#{id}"
   msgClose()
-  $.getJSON mqurl, (data) ->
+  request = $.ajax {url: mqurl}
+  request.done((data) ->
     locstr = nomToString(data.address)
-    msg locstr
+    msg locstr)
+  request.fail(ajaxErrorHandler)
 
 revGeocode = ->
   ###

  msgClose()
  # this next bit fires the RGC request and parses the result in a
  # decent way, but it looks really ugly.
  $.getJSON mqurl, (data) ->
    locstr = nomToString(data.address)
    # display a message saying where we are in the world
    msg locstr

drawFeatures = (features) ->
  ###

  ###
  # Gets a specific challenge
  ###
  request = $.ajax {url: "/api/c/challenges/#{id}"}
  request.done((data) ->
    challenge = data
    updateChallenge(challenge)
    updateStats(challenge)
    getTask())
  request.fail(ajaxErrorHandler)

@getNewChallenge = (difficulty, near) ->
  ###
  # Gets a challenge based on difficulty and location
  ###
  near = "#{map.getCenter().lng}|#{map.getCenter().lat}" if not near
  url = "/api/c/challenges?difficulty=#{difficulty}&contains=#{near}"
  request = $.ajax({
    url:  "/api/c/challenges?difficulty=#{difficulty}&contains=#{near}"})
  request.done((data) ->
    challenge = data.challenges[0]
    updateChallenge(challenge)
    updateStats(challenge)
    getTask(near))
  request.fail(ajaxErrorHandler)


@getTask = (near = null) ->
  ###
