Skip to content

Instantly share code, notes, and snippets.

@ryanjones
Created August 31, 2015 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanjones/5bead810c5134b004c00 to your computer and use it in GitHub Desktop.
Save ryanjones/5bead810c5134b004c00 to your computer and use it in GitHub Desktop.
jsonp
$(function () {
$('[data-toggle="tooltip"]').tooltip();
$('#membership-form').on('submit', function(e){
var member = $( "input:first" ).val();
e.preventDefault();
$.ajax({
method: "GET",
url: "https://api.ama.ab.ca/reward_dollars/promotions/3/contestants/"+ member +".jsonp",
jsonp: "callback",
dataType: "jsonp",
data: {
format: "json"
}
}).done(function( result ) {
if ( result["contestant"]["error"] == "" ) {
if ( result["contestant"]["claimed"] ) {
location = 'thanks-for-participating.html';
} else {
location = 'thank-you.html';
}
} else {
location = 'thank-you-for-participating.html';
}
});
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment