Skip to content

Instantly share code, notes, and snippets.

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 craiggrella/dd5e3388e253c0fa72032b28a34a6c56 to your computer and use it in GitHub Desktop.
Save craiggrella/dd5e3388e253c0fa72032b28a34a6c56 to your computer and use it in GitHub Desktop.
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