how to pass id from javacript to laravel php script? : <p>i am technically new to javascript and trying to pass a value to php script to use it in where clause...</p>

<p><strong>Blade html</strong> </p>

<pre><code>                    &lt;div class="tab-content blog_tabs"&gt;
                            &lt;div class="tab-pane" name="schedule" id="" &gt;
                                &lt;?php
                                    $tabSchedule = App\Schedule::where('route_id',  )   
                                                    -&gt;latest()
                                                    -&gt;get();
                                ?&gt;
                                @foreach ($tabSchedule as $schedule)
                                    &lt;ul class="list-group"&gt;
                                        &lt;li class="list-group-item"&gt;{{ $schedule-&gt;schedule_number}}&lt;/li&gt;
                                    &lt;/ul&gt;
                                @endforeach    
                            &lt;/div&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
</code></pre>

<p><strong>javascript</strong></p>

<pre><code>$("ul.nav-tabs &gt; li &gt; a").click(function() {
        var id = $(this).attr("href").replace("#", "");
        console.log(id);

        if(id) {
            $.ajax({
                url: "{{ route('user.schedule.getId') }}",
                type: "GET",
                data:{'id':id},
                dataType: "json",
                success:function(data) {

                    var route_id = 1;

                }
            });
        }    
    });
</code></pre>

<p>So here is a picture of what i want to pass:</p>

<p><a href="https://i.stack.imgur.com/oJuNi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oJuNi.png" alt="enter image description here"></a></p>

<p><strong><em>As picture tells i am trying to pass route_id to laravel php script to use it in where clause</em></strong></p>

<p>If any one, please help me out? thanks!</p>
