Hello fellow stackoverflow.
I'm up with a new question, here goes.

I would like to stuff the cookie of the following function in my ajax or javascript but I keep on failing to do ,
Here's my javascript function :

```
<script>
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];
    }
  } 
}

</script>

```

Now I would like it to appear like something like the below :-

```
setTimeout(function(){window.location = "https://www.something.com/index.html?affid=" + getQueryVariable("affid");}, 3000);

```

Is it possible to cookied the affid ??

So i would use something like this : 

```
setTimeout(function(){window.location = "https://www.something.com/index.html?affid=" + getCookie("affid");}, 3000);

```