   ###
   # Gets a specific challenge
   ###
-  $.getJSON "/api/c/challenges/#{id}", (data) ->
+  request = $.ajax {url: "/api/c/challenges/#{id}"}
+  request.done((data) ->
     challenge = data
     updateChallenge(challenge)
     updateStats(challenge)
-    getTask()
-
-getNewChallenge = (difficulty, near) ->
+    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}"
-  $.getJSON url, (data) ->
+  request = $.ajax({
+    url:  "/api/c/challenges?difficulty=#{difficulty}&contains=#{near}"})
+  request.done((data) ->
     challenge = data.challenges[0]
     updateChallenge(challenge)
     updateStats(challenge)
-    getTask(near)
+    getTask(near))
+  request.fail(ajaxErrorHandler)
+
 
 @getTask = (near = null) ->
   ###

  near = currentTask.center
  challenge = currentChallenge.id
  task_id = currentTask.id
  $.post "/c/#{challenge}/task/#{task_id}", payload, ->
    setDelay 1, ->
      clearTask()
      getTask(near)

@openIn = (e) ->
  ###

      tileAttrib = data.tileasttribution if data.tileattribution?
      changeMapLayer(tileURL, tileAttrib)
    currentChallenge.help = markdown.makeHtml(currentChallenge.help)
    currentChallenge.doneDlg = makeDlg(currentChallenge.doneDlg))
  request.fail(ajaxErrorHandler)

enableKeyboardShortcuts = ->
  ###
