Chriskonz
Chriskonz

Reputation: 199

Passing PHP variable with jQuery

I need an assistance on how to transfer this value $row[COMPONENT] in my class1.php into another page process_class.php with jQuery using post method.

i did this but it seems doesnt work ,

   $('.cuttingCheckbox').change(function() { 
       if (this.checked) { 
          $.post('process_class.php', 
          { comp : $($row[COMPONENT]).val(), comp_id : $($row[ID]).val() },

          function(response) { 
              this.setAttribute("disabled", true), alert(comp,comp_id); }); 
          } 

});

Does anyone willing to help me ?

Upvotes: 0

Views: 62

Answers (1)

doniyor
doniyor

Reputation: 37846

you can save that $row[COMPONENT] into session like this:

$_SESSION['row_component'] = $row[COMPONENT];

and in your next page, you just retrieve it:

$row = $_SESSION['row_component'];

As Jonast said (thanks dude), you should initiate the session first at the top of your php file: session_start();

Upvotes: 1

Related Questions