Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getCookie(cname, cb) {
- var name = cname + "=";
- var decodedCookie = decodeURIComponent(document.cookie);
- var ca = decodedCookie.split(';');
- for(var i = 0; i <ca.length; i++) {
- var c = ca[i];
- while (c.charAt(0) == ' ') {
- c = c.substring(1);
- }
- if (c.indexOf(name) == 0) {
- cb(c.substring(name.length, c.length));
- }
- }
- }
- function selectAffiliateField() {
- // IMPORTANT: The form field ID where you want to store the cookie value
- var fieldId = "affiliate_id_f1687";
- return document.getElementById(fieldId);
- }
- var affiliateFieldPresent = selectAffiliateField();
- if (affiliateFieldPresent) {
- getCookie("affwp_ref", function(id) {
- selectAffiliateField().value = id;
- });
- getCookie("affwp_erl_id", function(id) {
- selectAffiliateField().value = id;
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement