 
   $("#echo_ajax").click ->
     text = $("#echo").val()
-    $.ajax
-      url: "/ajax/echo"
+    request
+      url: "/echo"
       data:
         test: text
       success: (result) ->
         $("#echo_result").html escapeHtml(result)
         $("#echo").val ""
-      error: ajaxErr
 
   $("#register_btn").click ->
     input = $("#register_name")

      $("#hand a").click cardClicked

  getGameState = ->
    $.ajax
      url: "/ajax/game/get_state"
      success: (result) ->
        T.log result
        updateGameState result.game_state if result.game_state?
        updateHand result.hand if result.hand?

      error: ajaxErr
      data:
        akey: tupelo.player.akey
        game_id: tupelo.game_id

  # leave the game when the user leaves the page
  $(window).unload ->
    if tupelo.game_id?
      request
        url: "/game/leave"
        async: false
        data:
          akey: tupelo.player.akey
