title: Get data with route parameter
body: <p>How can i pass $id parameter from view to route ? I dont know well laravel .just i am learning.</p>
  
  <p>my controller</p>
  
  <pre><code>class YayinController extends Controller
  {
  public function index(){
  
      return view ('yayin.canli');
  }
  
  public function hamleler($id){
  
  
     $notations=Notasyon::where('id',$id)-&gt;orderBy('id', 'desc')-&gt;first();
      if($id==$notations-&gt;id){
          $lastgame=$notations-&gt;hamle;
          return response()-&gt;json($lastgame);
  
      }
     }
    }
  </code></pre>
  
  <p>I want to receive data according to this id value and send it to view1.</p>
  
  <p>if the id of the database data is the same as the id of the parameter, the data will continue to be pulled in 10 seconds. I want to do this with the data script code (in view getjsondata ())</p>
  
  <p>Routes</p>
  
  <pre><code>   Route::get('/canli-yayin/','YayinController@index');
     Route::get('/canli-yayin/hamleler/{id?}','YayinController@hamleler');
  </code></pre>
  
  <p>canli.blade.php</p>
  
  <pre><code> function getjsondata() {
  
  
  
   $.get("{{URL::To('canli-yayin/hamleler/')}}", function(data) {
  
  
         if(data) { 
   document.getElementById("notasyon").innerHTML=document.getElementById("notasyon").innerHTML+data+" ";
  
  }
   else {
        alert('error');
         }
         });
         }
  
  $(document).ready(function(){
          setInterval(getjsondata,3000)
  
      })
  </code></pre>