title: issue sending a retrieving value using ajax
body: <p>This is a cleaner code of my preview problem, the idea is to send and retrieve a value using ajax, but the value is not being sent nor ajax seems to work. I updated this code because this way it could be easily tested on any machine. First time using ajax. Here is the code:</p>
  
  <p>Javascript</p>
  
  <pre><code>&lt;script&gt;
  jQuery(document).ready(function() {
  jQuery('#centro').click( function() {
  $.ajax({
          url: 'request.php',
          type:'POST',
          data: $("#form").serialize(),
          dataType: 'json',
          success: function(output_string){
          alert(output_string);
                  $('#cuentas').html(output_string);
              } // End of success function of ajax form
          }); // End of ajax call    
  
    });
  
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>  &lt;?php
    $result = 'works';
    ?&gt;
  
    &lt;form id="form"&gt;
    &lt;div id="centro"&gt;
    &lt;a href="#"&gt;Click here&lt;/a&gt;
    &lt;br&gt;
    &lt;input type="hidden" name="centro" value="&lt;?php echo $result; ?&gt;"&gt;
    &lt;/form&gt;
  
    &lt;div id="cuentas"&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>PHP file, request.php</p>
  
  <pre><code> &lt;?php
   $centro = $_POST['centro'];
   $output_string = ''.$centro;
   echo json_encode($output_string);
   ?&gt;
  </code></pre>