Created
January 17, 2014 14:39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get API token for authorization header | |
token = session.get "apiToken" | |
id = record.get "_id" | |
### | |
xhr = new XMLHttpRequest() | |
xhr.onreadystatechange = -> | |
console.log arguments | |
xhr.open "DELETE", "http://#{ENV.domains.crud}/api/v1/pathways/#{id}" | |
xhr.setRequestHeader "Authorization", "Token token=#{token}" | |
xhr.setRequestHeader "Content-Type", "application/json" | |
xhr.send JSON.stringify record.toJSON() | |
console.log record.toJSON() | |
### | |
# Send pathway to server | |
$.ajax | |
url: "http://#{ENV.domains.crud}/api/v1/pathways/#{id}" | |
method: "DELETE" | |
dataType: "json" | |
contentType: "application/json" | |
data: | |
pathway: record.toJSON() | |
headers: | |
Authorization: "Token token=#{token}" | |
.then (json) -> | |
record.didDeleteRecord record, json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment