title: How to pass and get php value to jquery
body: <p>I have one problem in passing the value, and I can't pass it through the query string. My PHP is:</p>
  
  <pre><code> &lt;div class="menu"&gt;
          &lt;div class="sub_menu_header"&gt;ABOUT&lt;/div&gt;
          &lt;?php 
              $query1="SELECT id,title FROM aboutus_tbl";
              $resulto=mysql_query($query1);
              while ($row = mysql_fetch_array($resulto)) {
          ?&gt;
          &lt;a href="about" class="menuid" id="&lt;?php echo $row['id'];?&gt;"&gt;&lt;div class="&lt;?php echo $row['title'];?&gt;" id="sub_menu"&gt;&lt;?php echo $row['title'];?&gt;
          &lt;/div&gt;&lt;/a&gt;
          &lt;?php
          }
          ?&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>jQuery:</p>
  
  <pre><code> &lt;script&gt;
      $(".menuid").click(function() {
          date_time = $(this).attr('id');
          console.log(data);
          $.ajax({
              type: 'POST',
              url: 'about',
              data: {"aboutus_id" : date_time},
              success: function(data){
                  alert( data );
              }
          });
      });
      &lt;/script&gt;
  </code></pre>
  
  <p>Full code:</p>
  
  <pre><code>&lt;?php ob_start(); include('web/header.php');?&gt;
  &lt;!--main--&gt;
  &lt;div class="main_btm"&gt;
  &lt;div class="wrap"&gt;
  &lt;div class="main"&gt;
      &lt;div class="new_head"&gt;&lt;font size="5" color="#FC2B5F"&gt;
      &lt;script&gt;
      $(".menuid").click(function() {
          date_time = $(this).attr('id');
          console.log(data);
          $.ajax({
              type: 'POST',
              url: 'about',
              data: {"aboutus_id" : date_time},
              success: function(data){
                  alert( data );
              }
          });
      });
      &lt;/script&gt;
      &lt;?php
      if (isset($_POST['aboutus_id'])) {
          $id=$_POST['aboutus_id'];
          echo $id;
      }
      else{
          $id=1;
      }
      $que="SELECT title FROM aboutus_tbl WHERE id='".$id."'";
      $re=mysql_query($que);
      $r=mysql_fetch_array($re);
      echo $r[0];
      ?&gt;
      &lt;/font&gt;&lt;/div&gt;
      &lt;div class="menu"&gt;
          &lt;div class="sub_menu_header"&gt;ABOUT&lt;/div&gt;
          &lt;?php 
              $query1="SELECT id,title FROM aboutus_tbl";
              $resulto=mysql_query($query1);
              while ($row = mysql_fetch_array($resulto)) {
          ?&gt;
          &lt;a href="about" class="menuid" id="&lt;?php echo $row['id'];?&gt;"&gt;&lt;div class="&lt;?php echo $row['title'];?&gt;" id="sub_menu"&gt;&lt;?php echo $row['title'];?&gt;
          &lt;/div&gt;&lt;/a&gt;
          &lt;?php
          }
          ?&gt;
      &lt;/div&gt;
      &lt;div class="contant"&gt;
      &lt;div class="con_details"&gt;
      &lt;?php
          $query="SELECT * FROM aboutus_tbl WHERE id='".$id."'";
          $res=mysql_query($query);
          $result=mysql_fetch_array($res);
          $d1_per=explode("  ", $result['desc1']);
          $d1_lenth=sizeof($d1_per);
          $d2_per=explode("  ", $result['desc2']);
          $d2_lenth=sizeof($d2_per);
          $d3_per=explode("  ", $result['desc3']);
          $d3_lenth=sizeof($d3_per);
          if ($result['sub_title1']) {
      ?&gt;
      &lt;legend&gt;&lt;font size="5"&gt;&lt;?php echo $result['sub_title1'];?&gt;&lt;/font&gt;&lt;/legend&gt;
      &lt;?php
      }
      if ($result['desc1']) {
      for ($i=0; $i &lt; $d1_lenth; $i++) { 
          echo "&lt;p&gt;".$d1_per[$i]."&lt;/p&gt;";
      }
      }
      if ($result['sub_title2']) {
      ?&gt;
      &lt;legend&gt;&lt;font size="5"&gt;&lt;?php echo $result['sub_title2'];?&gt;&lt;/font&gt;&lt;/legend&gt;
      &lt;?php
      }
      if ($result['desc2']) {
      for ($i=0; $i &lt; $d2_lenth; $i++) { 
          echo "&lt;p&gt;".$d2_per[$i]."&lt;/p&gt;";
      }
      }
      if ($result['sub_title3']) {
      ?&gt;
      &lt;legend&gt;&lt;font size="5"&gt;&lt;?php echo $result['sub_title3'];?&gt;&lt;/font&gt;&lt;/legend&gt;
      &lt;?php
      }
      if ($result['desc3']) {
      for ($i=0; $i &lt; $d3_lenth; $i++) { 
          echo "&lt;p&gt;".$d3_per[$i]."&lt;/p&gt;";
      }
      }
      ?&gt;
      &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;script type="text/javascript"&gt;
  window.onload = function() {
      $(document).ready(function() {
          $('.&lt;?php echo $result['title']?&gt;').addClass('sub_menu_selected');
      });
  }
  &lt;/script&gt;
  &lt;?php include('web/footer.php'); ob_flush();?&gt;
  </code></pre>
  
  <p>In the above code, I display a menu in a <code>&lt;div&gt;</code> and <code>&lt;a&gt;</code> tags outside so I can click it. My problem is when I click on the menu it must take the <code>id</code> of the <code>menuid</code> class but it's not working and <code>$_POST['aboutus_id']</code> is not getting any value.</p>