ECHO post data from AJAX in PHP
<p>I want to echo the post data i get using AJAX-JQUERY.</p>

<p>I have a dropdown in that dropdown i show some values from database.
Now the item i select frmo dropdown is sent as POST to my controller.</p>

<p>If i open my network tab in browser, i can see the POST data i get using my AJAX script.</p>

<p>Like this:
<a href="https://i.stack.imgur.com/rX27i.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rX27i.png" alt="response"></a></p>

<p>But if i try to echo it shows me nothing on browser.</p>

<p>I am using this script:</p>

<pre><code>&lt;script type="text/javascript"&gt;

$( ".specialLink" ).click(function() {
      var site = this.id;
      var url= "&lt;?php echo base_url('customer/dashboard/index') ?&gt;"; 

       //get value for throw to controller

      $.ajax({ 
          type: "POST", //send with post 
          url: "&lt;?php echo base_url('customer/dashboard/index') ?&gt;", 
          data: {site:site}, 
          success:function(data){ 

          },

      });
  });
</code></pre>

<p></p>

<p>The DROPDOWN:</p>

<pre><code>&lt;li class="dropdown"&gt;
  &lt;a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"&gt;Your Sites &lt;span class="caret"&gt;&lt;/span&gt;&lt;/a&gt;
  &lt;ul class="dropdown-menu"&gt;
    &lt;?php
      foreach($sites as $site)
      {
        echo "&lt;li class='specialLink' id='".$site-&gt;site_key."'&gt;&lt;a href='#'&gt;".$site-&gt;site_key."&lt;/a&gt;&lt;/li&gt;";
      }
    ?&gt;
  &lt;/ul&gt;
&lt;/li&gt;
</code></pre>

<p><strong>THE PHP SCRIPT</strong></p>

<pre><code>var_dump($_REQUEST);
var_dump($_POST);
</code></pre>