{"action":"opened","issue":{"url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/304","repository_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project","labels_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/304/labels{/name}","comments_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/304/comments","events_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/304/events","html_url":"https://github.com/ga-wdi-boston/full-stack-project/issues/304","id":152862321,"number":304,"title":"PATCH data undefined","user":{"login":"susandaiute","id":16547482,"avatar_url":"https://avatars.githubusercontent.com/u/16547482?v=3","gravatar_id":"","url":"https://api.github.com/users/susandaiute","html_url":"https://github.com/susandaiute","followers_url":"https://api.github.com/users/susandaiute/followers","following_url":"https://api.github.com/users/susandaiute/following{/other_user}","gists_url":"https://api.github.com/users/susandaiute/gists{/gist_id}","starred_url":"https://api.github.com/users/susandaiute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/susandaiute/subscriptions","organizations_url":"https://api.github.com/users/susandaiute/orgs","repos_url":"https://api.github.com/users/susandaiute/repos","events_url":"https://api.github.com/users/susandaiute/events{/privacy}","received_events_url":"https://api.github.com/users/susandaiute/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-03T20:05:20Z","updated_at":"2016-05-03T20:05:20Z","closed_at":null,"body":"I'm trying to update a question and I'm getting data undefined.  If I set the click function to fire when .updateButton is clicked, then data is defined, but the patch request is sent too early, before the user can submit new information.  If I set it to the right button (.updateSubmitButton), then the data is undefined.\r\n\r\n```\r\n$('.updateSubmitButton').on('click', function(event) {\r\n    event.preventDefault();\r\n    console.log('click fired');\r\n    let data = getFormFields('.updateForm');\r\n    let buttonid = $('.updateButton').data('id');\r\n    updateQuestion(updateSuccess, failure, buttonid);\r\n    $('#updateQuestion').modal('hide');\r\n  });\r\n};\r\n```\r\n\r\n```\r\nconst updateQuestion = (updateSuccess, failure, id, data) => {\r\n    console.log(data);\r\n    $.ajax({\r\n        method: 'PATCH',\r\n        url: app.api + '/questions/' + id,\r\n        data: {\r\n          \"question\": {\r\n            \"title\": data.question.title,\r\n            \"answer1\": data.question.answer1,\r\n            \"answer2\": data.question.answer2,\r\n            \"answer3\": data.question.answer3\r\n          }\r\n        },\r\n        headers: {\r\n          Authorization: 'Token token=' + app.user.token,\r\n        },\r\n      }).done(updateSuccess)\r\n      .fail(failure);\r\n  };\r\n```\r\n\r\n```\r\n$('#updatePasswordForm').on('submit', function (event) {\r\n  let data = getFormFields(this);\r\n  event.preventDefault();\r\n  authApi.updatePassword(authUi.updateSuccess, authUi.failure, data);\r\n});\r\n```\r\n\r\n```\r\n <button type=\"button\" data-id=\"{{id}}\" data-toggle=\"modal\" data-target=\"#updateQuestion\" class=\"btn btn-default updateButton\">Edit</button>\r\n```"}}