title: Sending parameter as string or as date in JS
body: <p>I am trying to send a parameter in an AJAX call.
  I need to send it in a way that the receiver file can understand it as a date to be part of a mysql query.</p>
  
  <p>The page receives the value as URL parameter, like this:</p>
  
  <p><code>http://.....php?dia=2016-08-15</code></p>
  
  <p>Then on this page I make an AJAX call to send the param as POST data, like this:</p>
  
  <pre><code>var loadDataJRZ = function(){
      $.ajax({
          type: "POST",
          data: {dia: "&lt;?php echo $_GET['dia']?&gt;"},
  </code></pre>
  
  <p>And then in the receiver file I should get the param like this:
  <code>$dia = $_POST['dia'];</code></p>
  
  <p>If I execute the receiver file directly in the browser, the output is ok. But running the web page, the output is an empty string.</p>
  
  <p>This is the receiver file code:</p>
  
  <pre><code>$dia = $_POST['dia'];
  
  $sql = "SELECT *
          FROM dbo.LoteJuarez 
          WHERE  fecha = '$dia'  
          ORDER BY fecha, hora DESC";
  </code></pre>
  
  <p>I guess it is a matter of variable type, then I get the value dia = 903 if I send the AJAX call without <code>""</code>, like this</p>
  
  <pre><code> data: {dia: &lt;?php echo $_GET['dia']?&gt;},
  </code></pre>
  
  <p>and I get <code>dia="2016-08-15"</code> sending the call with <code>""</code></p>
  
  <pre><code>data: {dia: "&lt;?php echo $_GET['dia']?&gt;"},
  </code></pre>
  
  <p>Taking into account that a direct execution from the receiver file shows the query result as it should be, what should I change to make it work?</p>