title: Laravel Using AJAX to pass Javascript variable to PHP
body: <p>I am trying to pass a variable from my javascript code to the server side PHP code. I know this must be done via an ajax, But unfortunately I do not receive the value in the PHP variable in blade view.</p>
  
  <p>form : url = facture=20</p>
  
  <pre><code>{!! Form::open(array('url'=&gt; 'admin/facture=20', 'method'=&gt;'post',   'name'=&gt;'pushds')) !!}
  {!! Form::hidden('ms_id', $fact-&gt;id) !!}
  {!! Form::hidden('mstid', $fact-&gt;b_id, array('id' =&gt; 'mstid')) !!}     
  {!! Form::close() !!}
  </code></pre>
  
  <p>jquery : </p>
  
  <pre><code>$('form[name="pushds"]').on('submit', function (e){
      e.preventDefault();
  
    var mstid = $('#mstid').val();
    var ms_id = $('#ms_id').val();
  
          $.ajax({
              type: 'post',
              url: 'facture=20',            
              data: {mstid: $('#mstid').val(), ms_id : $('#ms_id').val()},
              success: function( data ) {
  ......
  },
  </code></pre>
  
  <p>the current page url : facture=20</p>
  
  <p>the variable php in blade view</p>
  
  <pre><code>&lt;?php 
  if (!empty($_POST["mstid "])) {
  echo $_POST['mstid ']; 
  }
  ?&gt;
  </code></pre>