{"action":"created","issue":{"url":"https://api.github.com/repos/ga-wdi-boston/game-project/issues/157","repository_url":"https://api.github.com/repos/ga-wdi-boston/game-project","labels_url":"https://api.github.com/repos/ga-wdi-boston/game-project/issues/157/labels{/name}","comments_url":"https://api.github.com/repos/ga-wdi-boston/game-project/issues/157/comments","events_url":"https://api.github.com/repos/ga-wdi-boston/game-project/issues/157/events","html_url":"https://github.com/ga-wdi-boston/game-project/issues/157","id":146756790,"number":157,"title":"AJAX PATCH REQUEST: api.updateGame is not defined","user":{"login":"rdelvallej32","id":17518260,"avatar_url":"https://avatars.githubusercontent.com/u/17518260?v=3","gravatar_id":"","url":"https://api.github.com/users/rdelvallej32","html_url":"https://github.com/rdelvallej32","followers_url":"https://api.github.com/users/rdelvallej32/followers","following_url":"https://api.github.com/users/rdelvallej32/following{/other_user}","gists_url":"https://api.github.com/users/rdelvallej32/gists{/gist_id}","starred_url":"https://api.github.com/users/rdelvallej32/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdelvallej32/subscriptions","organizations_url":"https://api.github.com/users/rdelvallej32/orgs","repos_url":"https://api.github.com/users/rdelvallej32/repos","events_url":"https://api.github.com/users/rdelvallej32/events{/privacy}","received_events_url":"https://api.github.com/users/rdelvallej32/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-04-07T22:12:17Z","updated_at":"2016-04-07T22:50:55Z","closed_at":null,"body":"I ran the debugger, and I am getting the message that my updateGame function is not defined, but I referenced the file path from my api to the moves.js folder. Is there an error as to how I am going about this function? moves.js and api.js are living in two seperate directories.\r\n\r\n```js\r\n\r\n///my api file\r\n\r\n'use strict';\r\n\r\nconst app = require('../app-data');\r\nconst gameMoves = require('../game/move.js');\r\n\r\nconst signUp = (success, failure, data) => {\r\n  $.ajax({\r\n    method: \"POST\",\r\n    url: app.api + '/sign-up',\r\n    data,\r\n\r\n  })\r\n  .done(success)\r\n  .fail(failure);\r\n};\r\n\r\nconst signIn = (success, failure, data) => {\r\n  $.ajax({\r\n    method: \"POST\",\r\n    url: app.api + '/sign-in',\r\n    data,\r\n\r\n  })\r\n  .done(success)\r\n  .fail(failure);\r\n};\r\n\r\nconst signOut = (success, failure) => {\r\n  //if(!app.user) bad;\r\n  $.ajax({\r\n    method: \"DELETE\",\r\n    url: app.api + '/sign-out/' + app.user.id,\r\n    headers: {\r\n      Authorization: 'Token token='+ app.user.token,\r\n    },\r\n  })\r\n  .done(success)\r\n  .fail(failure);\r\n};\r\n\r\nconst passwordChange = (success, failure, data) => {\r\n  //if(!app.user) bad;\r\n  $.ajax({\r\n    method: \"PATCH\",\r\n    url: app.api + '/change-password/' + app.user.id,\r\n    data,\r\n    headers: {\r\n      Authorization: 'Token token='+ app.user.token,\r\n    },\r\n  })\r\n  .done(success)\r\n  .fail(failure);\r\n};\r\n\r\nconst gameCreate = (success, failure) => {\r\n  //if(!app.user) bad;\r\n  $.ajax({\r\n    method: \"POST\",\r\n    url: app.api + '/games',\r\n    headers: {\r\n      Authorization: 'Token token='+ app.user.token,\r\n    },\r\n  })\r\n  .done(success)\r\n  .fail(failure);\r\n};\r\n\r\nconst updateGame = (success, failure) => {\r\n  //if(!app.user) bad;\r\n  debugger;\r\n  $.ajax({\r\n    method: \"PATCH\",\r\n    url: app.api + '/games/' + app.gameID,\r\n    headers: {\r\n      Authorization: 'Token token='+ app.user.token,\r\n    },\r\n    data: {\r\n      \"game\": {\r\n        \"cell\": {\r\n          \"index\": app.index,\r\n          \"value\": app.value\r\n        },\r\n          // \"over\": app.game.over,\r\n      }\r\n    }\r\n\r\n  })\r\n  .done(success)\r\n  .fail(failure);\r\n};\r\n\r\nmodule.exports = {\r\n  signUp,\r\n  signIn,\r\n  signOut,\r\n  passwordChange,\r\n  gameCreate,\r\n  updateGame,\r\n  app,\r\n};\r\n\r\n////this is my move.js file\r\n\r\n'use strict';\r\n\r\nconst app = require('../app-data.js');\r\nconst api = require('../auth/api.js');\r\nconst ui = require('../auth/ui.js');\r\n\r\nlet gameBoard = ['','','','','','','','',''];\r\nlet currentPlayer = '';\r\nlet turn = 0;\r\nlet playerIcon = ['X', 'O'];\r\nlet win = false;\r\n\r\n  const checkWin = function(gameBoard) {\r\n        if (currentPlayer === gameBoard[0] && currentPlayer === gameBoard[1] && currentPlayer === gameBoard[2] ||\r\n            currentPlayer === gameBoard[3] && currentPlayer === gameBoard[4] && currentPlayer === gameBoard[5] ||\r\n            currentPlayer === gameBoard[6] && currentPlayer === gameBoard[7] && currentPlayer === gameBoard[8] ||\r\n            currentPlayer === gameBoard[0] && currentPlayer === gameBoard[3] && currentPlayer === gameBoard[6] ||\r\n            currentPlayer === gameBoard[1] && currentPlayer === gameBoard[4] && currentPlayer === gameBoard[7] ||\r\n            currentPlayer === gameBoard[2] && currentPlayer === gameBoard[5] && currentPlayer === gameBoard[8] ||\r\n            currentPlayer === gameBoard[0] && currentPlayer === gameBoard[4] && currentPlayer === gameBoard[8] ||\r\n            currentPlayer === gameBoard[2] && currentPlayer === gameBoard[4] && currentPlayer === gameBoard[6]){\r\n\r\n        console.log(\"Player \" + currentPlayer + \" wins!\");\r\n        win = true;\r\n          $('.tile').off('click');\r\n      }\r\n\r\n    };\r\n\r\n    const checkTie = function() {\r\n        if(turn >=9 && win === false) {\r\n          console.log('Tie game! Start a new game');\r\n        }\r\n\r\n    };\r\n\r\nconst playerMove = function() {\r\n  $('.tile').one('click', function(){\r\n    if(turn % 2 === 0) {\r\n      currentPlayer = playerIcon[0];\r\n      $(this).removeClass('available').addClass('player1');\r\n    }\r\n    else {\r\n      currentPlayer = playerIcon[1];\r\n      $(this).addClass('player2');\r\n    }\r\n    turn++;\r\n    let currentTile = $(this);\r\n      currentTile.text(currentPlayer);\r\n      $(this).data('gameBoard', currentPlayer);\r\n      let attrId = $(this).attr('id');\r\n      gameBoard[attrId] = currentPlayer;\r\n      console.log(gameBoard[attrId]);\r\n      console.log(attrId);\r\n      console.log(gameBoard);\r\n      currentTile.text(currentPlayer);\r\n      debugger;\r\n      app.index = $(this).attr('id');\r\n      app.value = currentPlayer;\r\n      // console.log(api.updateGame(ui.success, ui.failure));\r\n      api.updateGame(ui.success, ui.failure); ///I'm calling the function here.\r\n      checkWin(gameBoard);\r\n      checkTie(gameBoard);\r\n\r\n    });\r\n  };\r\n\r\n  const clearBoard = function() {\r\n    $('.newGame').find('#eraseBoard').on('click', function() {\r\n      $('.tile').each(function() {\r\n        $(this).text('');\r\n      });\r\n      $('.tile').each(function() {\r\n        $(this).removeClass('player1').removeClass('player2').addClass('available');\r\n      });\r\n      $(this).removeAttr('id');\r\n    });\r\n  };\r\n\r\n\r\nmodule.exports = {\r\n  playerMove,\r\n  clearBoard,\r\n};\r\n\r\n///this is my index.js, where i call the functions\r\n\r\n'use strict';\r\n\r\n// user require with a reference to bundle the file and use it in this file\r\n// var example = require('./example');\r\nconst authEvents = require('./auth/events.js');\r\nconst gameMove = require('./game/move.js');\r\nconst gameLogic = require('./game/gameplay.js');\r\n//\r\n// // use require without a reference to ensure a file is bundled\r\n// require('./example');\r\n\r\n$(() => {\r\n  authEvents.signCheck();\r\n  authEvents.gameCheck();\r\n  gameMove.playerMove();\r\n  gameMove.clearBoard();\r\n});"},"comment":{"url":"https://api.github.com/repos/ga-wdi-boston/game-project/issues/comments/207126270","html_url":"https://github.com/ga-wdi-boston/game-project/issues/157#issuecomment-207126270","issue_url":"https://api.github.com/repos/ga-wdi-boston/game-project/issues/157","id":207126270,"user":{"login":"RDegnen","id":8826469,"avatar_url":"https://avatars.githubusercontent.com/u/8826469?v=3","gravatar_id":"","url":"https://api.github.com/users/RDegnen","html_url":"https://github.com/RDegnen","followers_url":"https://api.github.com/users/RDegnen/followers","following_url":"https://api.github.com/users/RDegnen/following{/other_user}","gists_url":"https://api.github.com/users/RDegnen/gists{/gist_id}","starred_url":"https://api.github.com/users/RDegnen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RDegnen/subscriptions","organizations_url":"https://api.github.com/users/RDegnen/orgs","repos_url":"https://api.github.com/users/RDegnen/repos","events_url":"https://api.github.com/users/RDegnen/events{/privacy}","received_events_url":"https://api.github.com/users/RDegnen/received_events","type":"User","site_admin":false},"created_at":"2016-04-07T22:50:55Z","updated_at":"2016-04-07T22:50:55Z","body":"So is this resolved?"}}