Skip to content

Instantly share code, notes, and snippets.

@scottwater
Created January 18, 2012 02:26
Show Gist options
  • Save scottwater/1630460 to your computer and use it in GitHub Desktop.
Save scottwater/1630460 to your computer and use it in GitHub Desktop.
jQuery ->
$("form").submit (e) ->
e.preventDefault()
email = $("#email").val()
return if email.length == 0
$.ajax
url: "https://api.kickofflabs.com/v1/1905/subscribe",
data: "email=#{email}",
dataType: 'jsonp',
jsonp: 'jsonp',
jsonpCallback: 'subscribe_callback',
timeout: 2000,
error: (a, b, e) ->
alert e
console.log e
this.subscribe_callback = (data) ->
alert("Signed up #{data.email}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment