Hi,
I have the following code which is supposed to add a cookie based on teh URL into a form. However, iot is not working.
Can anyone see anything wrong with the below code?
function gup(name) {
return decodeURI(
(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
);
}
$( document ).ready(function() {
var curRef = $.cookie('ref');
if (curRef != null) {
if ((curRef != "mydefault") && (curRef.substring(0, 3) != "ppc")) {
$('input[name=tmp]').val("discount");
$('input[name=company]').val($.cookie('ref'));
}
}
if (gup("ref") != "null") {
var curRefURL = gup("ref");
if ((curRefURL != "mydefault") && (curRefURL.substring(0, 3) != "ppc")) {
$('input[name=tmp]').val("discount");
$('input[name=company]').val(curRefURL);
}
}
});
Thanks!