Thameera
1 year ago
156
9
Laravel

path for ajax in laravel

Posted 1 year ago by Thameera

{$('select[name="sup_id1"]').on('change', function() { var stateID = $(this).val(); if(stateID) { $.ajax({ url: "{{route( '/stockoutward/return/'+stateID)}}", type: "GET", dataType: "json", success:function(data) {

                        $('select[name="bill1"]').empty();
                        $.each(data, function(key, value) {
                            $('select[name="bill1"]').append('<option value="'+ key +'">'+ value +'</option>');
                        });

                    }
                });
            }else{
                $('select[name="bill1"]').empty();
            }
        });

    });}

my code is this but my route shows error "Use of undefined constant stateID " like this my routes is Route::get('stockoutward/return/{id}',array('as'=>'myform.ajax','uses'=>'Admin\[email protected]')); what is the problem in my route

Please sign in or create an account to participate in this conversation.