0

I have a little problem, i want to get my unique generated variable from a PHP page to another page but in jquery to use'it in a link. Here is my code !

page reg.php

<?php $randstring = "variable" ?>

page index.php

$("#subscribe_form").submit(function()
{

    //remove all the class add the messagebox classes and start fading
    $("#msgboxs").removeClass().addClass('messagebox').text('Validating....').fadeIn(1200);
    //alert ('Pass 1');
    $.post("a_subscribe.php",{ firstname:$('#firstname').val(),lastname:$('#lastname').val(),email:$('#email').val(),phone:$('#phone').val(),rand:Math.random() }, function(data)
    {

        var dataarray= data.split(',');

      if(dataarray[0]=='yes') //if correct login detail
      {

        $("#msgboxs").fadeTo(2000,1,function()  //start fading the messagebox
        { 

          //add message and change the class of the box and start fading
          $("#msgboxs").html('').removeClass()
          //$("#msgboxs").html(dataarray[1]).addClass('messageboxok')
          $("#artist-form").hide();
          $("#request-success").show();

here i need to take the variable to use in window.open

how i can extract variable from upper page , $randstring

          window.open(url, "http://clubgtm.com/en/confirmemail?gt='.$randstring.'")
Pete
  • 57,112
  • 28
  • 117
  • 166
Malasuerte94
  • 1,454
  • 3
  • 14
  • 18
  • 1
    you could use `purl.js` to get the querystring and then use `split` to get what you need. – r3wt Jan 14 '15 at 15:11
  • `window.open(url, "http://clubgtm.com/en/confirmemail?gt=")` ? – Pete Jan 14 '15 at 15:18
  • your question is not clear. you wrote 1. ` reg.php` = `$randstring = "variable"` 2. `index.php` = `rand:Math.random()` 3. `index.php` = `$.post("a_subscribe.php"` 4. `$randstring window.open(url, "http://clubgtm.com/en/confirmemail?gt=` So could you explain clearly from what page to what page do you want to pass value? where that value appear first (reg.php, index.php, confirmemail.php)? – Alex Jan 14 '15 at 15:20
  • i just solved :D i have used var = dataarray[2]; – Malasuerte94 Jan 14 '15 at 18:42

0 Answers0