Cookie in form from URL issue


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(||[,null])[1]

$( document ).ready(function() {
var curRef = $.cookie('ref');
if (curRef != null) {
if ((curRef != "mydefault") && (curRef.substring(0, 3) != "ppc")) {

if (gup("ref") != "null") {
var curRefURL = gup("ref");
if ((curRefURL != "mydefault") && (curRefURL.substring(0, 3) != "ppc")) {



null != “null”

Thanks, I’ve changed that, but the script doesn’t seem to be applying the cookie reference. Any ideas what else I could have wrong?


have you tested that gup() does what you think it does? have you checked what the variables really contain?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.