skip to Main Content

I’ve got spinning wheel script that I’m trying to use to give away small prizes to visitors when they login to a website. The wheel animation all works great and the script puts the ‘result’ into a variable and displays that in a modal on the page. You can see it in action here…

https://ezclix.club/wheel2/index.asp

The result value shows up as the third line in the modal, inserted t oa span #displayprice.

 var response = "";
 response += selectedSegment.winResult;
 $("#displayprice").html(response);

I just need to get that value to the next page, so I can actually ‘award’ the prize, but so far nothing I’ve tried seems to work.

I tried setting a cookie but that doesn’t make it through.

 setCookie("Prize", response, 1)

I’ve tried adding a form to the modal, and using jquery to update an input with the result value, but that doesn’t want to work either.

$('input[id=passprize]').val(response);
$('input[name=passprize]').val(response);

I’ve tried adding a whole new form input, but no go there as well.

I don’t do much with jquery and my experience is mostly limited to minor edits to existing scripts, but the edits above are all things I’ve done in the past, so I’m stumped.

Any ideas at all much appreciated!

Here’s the full function…

function alertWinResult(selectedSegment) {

jQuery(".spin_pin").rotate(0);
$("#spinWinResult").text(globlefuncgeneral.gameover_text);
$(".power_controls").hide();

var response = "";
response += selectedSegment.winResult;
$("#displayprice").html(response);

// My variousattempts... 

setCookie("Prize", response, 1)

$('input[id=passprize]').val(response);
$('input[name=passprize]').val(response);

}

3

Answers


  1. Chosen as BEST ANSWER

    I'm not sure how or why, but the form part of this is now working. The snippet above is populating the field so that's getting passed to the next page.

    I left it for a while, came back a few hours and it worked without any further changes. So guessing there's some caching going on maybe?

    Either way, sorry to waste people's time on this and thanks for your suggestions.


  2. You can use url parameter to pass the prize when redirect to next page url/action?prize={response}

    Login or Signup to reply.
  3. enter code here
    
    //Using cookie
    setCookie("Variable", response, value)
    
    //using url redirect 
    next page url/action?Variable=value
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search