Answers for "set options using jquery in laravel form collective"

0

set options using jquery in laravel form collective

<script>
    $(document).ready(function() {

            //Make an Ajax request to a Laravel route
            //This will return the data that we can add to our Select element.
            $.ajax({
                url: 'YOUR URL GOES HERE',
                type: 'get',
                success: function(data){

                    //Log the data to the console so that
                    //you can get a better view of what the script is returning.
                    console.log(data);

                    $.each(data, function(key, value){
                        //Use the Option() constructor to create a new HTMLOptionElement.
                        var option = new Option(key, value);
                        //Convert the HTMLOptionElement into a JQuery object that can be used with the append method.
                        $(option).html(value);
                        //Append the option to our Select element.
                        $("#job").append(option);
                    });

                }
            });

        });
</script>
Posted by: Guest on September-22-2020
0

set options using jquery in laravel form collective

//...
{!! Form::select('jobsList[]', [], null, ['id' => 'job', 'class' => 'form-control' 'multiple', 'style' => 'width: 60%; margin-top: 10px;', 'disabled'=>'disabled']) !!}
..//
Posted by: Guest on September-22-2020

Code answers related to "set options using jquery in laravel form collective"

Code answers related to "Javascript"

Browse Popular Code Answers by Language