Skip to content

Instantly share code, notes, and snippets.

@matiit
Created November 27, 2014 15:37
Show Gist options
  • Save matiit/57226425b13faa176c87 to your computer and use it in GitHub Desktop.
Save matiit/57226425b13faa176c87 to your computer and use it in GitHub Desktop.
authentify: (user) ->
deferred = $.Deferred()
$.ajax(
type: 'POST'
url: '/auth/register'
data: view.model.toJSON()
success: (data) =>
console.log "I am in succes??"
deferred.resolve()
error: (err, errn) =>
console.log "I am in reject?"
deferred.reject(err.responseJSON)
view.showError('.signup-alert', 'Could not register you. Try later.')
)
deferred.promise()
// Other file
user = new User(Bootstrap.user)
authentify(user).done( =>
@close()
window.location.reload()
).fail( (data) =>
console.log "here"
console.log(data)
)
// I can see "I am in reject?" but can't see "here"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment