create github issue from javascript code example
Example: create github issue from javascript
function createIssue(repoName, repoOwner, issueTitle, issueBody, accessToken) { var interactor = new GithubInteractor(accessToken); var url = “https://api.github.com/repos/" + repoOwner + “/” + repoName + “/issues”; $.ajax({ url: url, type: “POST”, beforeSend: function(xhr) { xhr.setRequestHeader(“Authorization”, “token “ + interactor.token); }, data: JSON.stringify({ title: issueTitle, body: issueBody }) }).done(handleResponse) .fail(handleError);}function handleSubmit() { $(‘form’).on(‘submit’, function(event){ var repoName = $(‘#repoName’).val(); var repoOwner = $(‘#repoOwner’).val(); var issueTitle = $(‘#title’).val(); var issueBody = $(‘#body’).val(); var accessToken = $(‘#accessToken’).val(); createIssue(repoName, repoOwner, issueTitle, issueBody, accessToken); event.preventDefault(); });}