title: Checking php session by ajax
body: <p>I'd like run <code>INSERT</code> query by ajax. That query need value from php session but js request doesn't see that value. Whay it's happend ? What should i do ?</p>
  
  <p>Some code below:</p>
  
  <p>JS:</p>
  
  <pre><code>$('div#content').on( "submit" , "form" , function ( event ){
          event.preventDefault();
          var href        = "ajaxRequest.php" + $(this).attr("action");
          var method      = $(this).attr("method");
          var values      = $(this).serializeArray();
  
          $.ajax({
              url         : href,
              data        : values,
              type        : method,
              dataType    : "html",
              cache       : false,
              success     : function ( content ){
                  alert( content );
              }
          });
  
      });
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>public function addBoard( $params = null )
          {
              $ID_user            =   $_SESSION[ 'user_id' ];
              $board_model        =   $params[ 'board_model' ];
  
              $query = "INSERT INTO `".prefix."boards` (                      
                          `ID_user` ,
                          `board_model`
                          )
                      VALUES (
                          '$ID_user', '$board_model');";
  
              if( $this-&gt;SQL-&gt;dbquery( $query ) )
                  echo 'Added';
              else
                  echo 'Failed';
          }
  </code></pre>