Laravel Ajax URL pass multiple paramters value



<!DOCTYPE html>
<head>
    <meta name="csrf-token" content="{{ csrf_token() }}" />
</head>
<body>
<button class="edit">Edit</button>
<body>
</html>

web.php
Route::get('/flight/booking/show/{id}/{mode}', [ FlightController::class, 'show'])->name('flight.show');
$('body').on('click', '.edit',function(){
    let recId = $(this).data('red_id');
    let mode = $(this).data('mode');
    let url = "{{ route('flight.show', ['id' => ':id', 'mode'=>':mode']) }}";
            url = url.replace(':id', recId);
            url = url.replace(':mode', mode);
    $.ajax({
        url: url,
        type: 'GET',
        beforeSend : function(){
        },
        done: function(){
            /* AFTER SUBMIT COMPLETE ENABLE SUBMIT BUTTON */
        },
        success: function(resp) {
        },
        error: function(jqXHR, textStatus, errorThrown) {
        if(jqXHR.status == 422){
            let response = JSON.parse(jqXHR.responseText);
        }
        }
    })
})
Share on Google Plus

About Ram Pukar

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment

0 comments:

Post a Comment