Ajax call to fill HTML table

Posted In Laravel
  • youtta 2 weeks ago
    ```
    I have the select dropdown:
    <select class="form-control" id="cup">
                @foreach($tourname as $value)
                    <option value="{{ $value->tournament_id }}">{{ $value->name}}</option>
                @endforeach
            </select>
    		
    				
    I want to show the table of specific ID records on the 'Onchange' event of ajax. Please guide Ajax I am new to it.
    
    
    <table class="table table-sm table-hover  table-striped" id="table">
            <thead>
            <tr>
                <th>Club </th>
                <th>Vs</th>
                <th>Club</th>
                <th>Match Type</th>
                <th>Date</th>
                <th>Time</th>
                <th>Status</th>
                <th>Edit</th>
                <th>Delete</th>
            </tr>
            </thead>
            <tbody>
    
            @if($matches->count() > 0)
            @else
                <th colspan="5" class="text-center">No any matches</th>
            @endif
    
            </tbody>
        </table>
    		
    I have the select dropdown:
    <select class="form-control" id="cup">
                @foreach($tourname as $value)
                    <option value="{{ $value->tournament_id }}">{{ $value->name}}</option>
                @endforeach
            </select>
    		
    				
    I want to show the table of specific ID records on the 'Onchange' event of ajax. Please guide Ajax I am new to it.
    
    
    <table class="table table-sm table-hover  table-striped" id="table">
            <thead>
            <tr>
                <th>Club </th>
                <th>Vs</th>
                <th>Club</th>
                <th>Match Type</th>
                <th>Date</th>
                <th>Time</th>
                <th>Status</th>
                <th>Edit</th>
                <th>Delete</th>
            </tr>
            </thead>
            <tbody>
    
            @if($matches->count() > 0)
            @else
                <th colspan="5" class="text-center">No any matches</th>
            @endif
    
            </tbody>
        </table>
    		
    

Please login or signup to leave a response.