title: how to assign jquery variable to php variable in Laravel
body: <p>Inside a toolbar.blade I have this:</p>
  
  <pre><code>&lt;script&gt;
  $('.form-control').on('change',function(){
  var TourDate = document.getElementById('TourDate').value;
  if($('#TourDate_hidden').val()=="" || $('#TourID').val()==""){
      return;
    }
  keyword= '_kfdTourDate:equal:'+$('#TourDate_hidden').val()+'|';
  keyword+= '_kfnTourID:equal:'+$('#TourID').val();
  
  reloadData( '#{{ $pageModule }}',"{{ $pageUrl }}/data?search="+keyword);    
  console.log(TourDate);
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Also I have a text input and a selectbox in toolbar.blade. 
  the input and selectbox look like this:</p>
  
  <pre><code>    &lt;input type="text" class="form-control" name="TourDate" 
  id="TourDate" data-value="{{$testdate}}"&gt;
  
  @if(count($tourTypes))
    &lt;select name="_kfdTourID" id="TourID" onkeyup='saveValue(this);'&gt;
      @foreach($tourTypes as $tourType)
        &lt;optgroup label="{{ $tourType-&gt;_kftDescription }}"&gt;
            @if(count($tourType-&gt;tours))
            @foreach($tourType-&gt;tours as $tour)
            &lt;option value="{{ $tour-&gt;_kpnID }}"&gt;{{ $tour-&gt;tDescription }}&lt;/option&gt;
            @endforeach
            @endif
        &lt;/optgroup&gt;
      @endforeach
    &lt;/select&gt;
  @endif
  </code></pre>
  
  <p>When I click on text input, a boostrap calendar is poping up, after selecting a date it's showing the selected date inside the input and the page is reloading with the new filtered data trough ajax</p>
  
  <p>e.g. <code>XHR finished loading: GET "http://www.website.com/bookings/data?search=_kfdTourDate:equal:2017-03-11|_kfnTourID:equal:4</code></p>
  
  <p>After the page is reloaded trough ajax the value inside the input is becoming empty and the first option in the selectbox is being selected automatically. </p>
  
  <p>When I write </p>
  
  <pre><code>@php
          $testdate = "16/03/2017";
  @endphp
  </code></pre>
  
  <p>above the input I can see the date <code>16/03/2017</code> inside the input. Also I can print the selected tour date using <code>console.log(TourDate)</code> Even after I refresh the page the date 16/03/2017 stays inside the input. But somehow I cannot assign jquery variable <strong>TourDate</strong> to php variable <strong>testdate</strong>. How can I keep the data-value for the input and mark the selected option as selected  after the page is refreshed? </p>
  
  <p>I tried this: <a href="https://stackoverflow.com/questions/38930144/keep-input-value-after-refresh-page">keep input value after refresh page</a> but couldn't make it work. I tried almost everything the whole day. I desperately need help to make this work. Thanks in advance for help.</p>