0

In Laravel 10 / jquery: 3.6.1 app with laravelcollective/html 6.2 library I need pass multiselect parameters to post request and having select :

<div class="flex-grow-1 w-100">
    {!! Form::select(
        'itemStatus[]',
        $itemStatusItems,
        null,
        [
            'class' => 'form-control selectpicker',
            'multiple' => true,
            'data-none-selected-text' => trans('Item Status'),
        ],
        $itemStatusSelected,
    ) !!}
</div>

I call JS function where I need to pass multiple parameters:

function showtItems() {
    // lI got error : items?d=:787 Uncaught TypeError: $(...).multiselect is not a function
    let itemStatus = $('#itemStatus').multiselect();

    $.ajax({
        url: '{{ route('getData', $point->id ) }}',
        type: 'post',
        data: {itemStatus: itemStatus},
        success: function (data) {
            ...
        }
    }).done().fail(function (data) {
        ...
    });
    point.stopPropagation();
    return false;


}

Is it a valid way to get selected items ? In the net I found some examples like that, but error in imuy case...

5
  • 1
    select2.org/getting-started/… you can check this Commented Feb 3 at 10:57
  • Is it implemented with select2 component ? Commented Feb 3 at 11:43
  • Hello, you could post the git link of each lib so we can search for better response Commented Feb 3 at 12:23
  • 1
    yes you can use like this this is sample.. you edit acording you own {!! Form::select('course_id[]', $courses, $course_id , ['class' => 'form-control leaderMultiSelctdropdown select2' , 'multiple'=>"multiple",'id'=>'leaderMultiSelctdropdown', 'required' => 'required']) !!} Commented Feb 3 at 13:39
  • How how to get selected values ? Commented Feb 3 at 14:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.