Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Adds ability to collect donation amounts in string query passed in URL. Great for adding auto amounts in buttons and text inside emails.
// Added by CraigGrella.com for pinning amount to string query
// Used for creating buttons in emails with links for specific dollar amounts
function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
jQuery(function($){
var amt = getQueryVariable("donation_amt");
if (!amt) return;
$('#donation_amount_'+amt).attr('checked', true);
// Uncomment to Automatically progress to second stage
// $('.progress-stage-button-next').click();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment