Yii2 Ajax onChange onBlur load product items details

$("input[id='acceptapplication-mouja']").replaceWith('');
            //$("input[id='acceptapplication-j_l_no']").replaceWith('');

            $("select[id*='sub_district']").change(function(){

                var subDistrictId = $("select[id*='sub_district']").val();
//
                $("input[id='acceptapplication-mouja']").replaceWith('');
//                $("input[id='acceptapplication-j_l_no']").replaceWith('');
//


                $.ajax({
                    url: 'getUrlManager()->createUrl("acceptapplication/getmoujajlno") ?>' ,
                    data: { id : subDistrictId },
                    type : 'POST',
                    success: function (json) {
//                        $("#acceptapplication-mouja").remove();
//                        $("#acceptapplication-j_l_no").remove();

                        var selectOptionsMouja = " Select Mouja ";
                        //var selectOptionsJLNo = "";
                        var jsona = JSON.parse(json);

                        $.each(jsona,function(i,m){

                            selectOptionsMouja += ""+ m.mouja +"";
                            //selectOptionsJLNo =  m.j_l_no ;

                        });

                        $("#acceptapplication-mouja").empty().append(selectOptionsMouja);
                        //$("#acceptapplication-j_l_no").val(selectOptionsJLNo);

                    }
                });
            });


            $("#acceptapplication-j_l_no").blur(function(){

                var JLNo = $("#acceptapplication-j_l_no").val();

                $.ajax({
                    url: 'getUrlManager()->createUrl("acceptapplication/getmoujas") ?>' ,
                    data: { id : JLNo },
                    type : 'POST',
                    success: function (json) {

                        var obj = JSON.parse(json);

                        var selectOptionsMouja = " " + obj.mouja +"";

                        $("#acceptapplication-mouja").append(selectOptionsMouja);

                    }
                });
            });


            $("#acceptapplication-mouja").change(function(){

                var mouja = $("#acceptapplication-mouja").val();

                $.ajax({
                    url: 'getUrlManager()->createUrl("acceptapplication/getjlnos") ?>' ,
                    data: { id : mouja },
                    type : 'POST',
                    success: function (json) {

                        var obj = JSON.parse(json);

                        var selectOptionsJLNo = obj.j_l_no ;

                        $("#acceptapplication-j_l_no").val(selectOptionsJLNo);

                    }
                });
            });

        });


    

Advertisements

Change Yii2 Grideview Column Label

GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'id',
            'name',
            [
                'attribute' => 'Category Name',
                'value' => 'category.name'
            ],
            'created_at',
            'updated_at',
            // 'user_id',
            // 'item_code',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]);