jeudi 26 avril 2018

jQyery get() not working, Laravel 5

Using Jquery in Laravel 5. When a select option is updated by the user, the next select option will be updated and populated depending on what was chosen in the first.

Everything works fine until trying to run $get(), then nothing happens. Everything works when routing manually with the url in browser, but for some reason $get() does not fire, even tried with running it only with a url, but no result.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
    $(document).ready(function(){
        setListener(); 
    });

    function setListener() {
        $('#company').change(function() {
            let value = $(this).val();
            alert(value);
            $.get( '/home/package/create' + value, function( data ) {            
                $('#department').empty();
                $('#department').append(data);
                alert('action performed');
            });
        });
    }
</script>



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Kgtcz7
via IFTTT

Aucun commentaire:

Enregistrer un commentaire