How to set id for AJAX

Hi guys, I have following Jquery-Script, which works fine outside of yii2





        <script>

            $(function () {

                $(".comment_button").click(function () {

                    var element = $(this);

                    var test = $("#_id_").val();

                    var dataString = '_id_=' + test;

                    if (test == '')

                    {

                        alert("No record, no action...!");

                    } else

                    {

                        $.ajax({

                            type: "POST",

                            url: '<?=\Yii::$app->urlManager->baseUrl?>/insert.php',

                            //url: 'insert.php',

                            data: dataString,

                            cache: false,

/*

                            success: function (html) {

                                $("#display").after(html);

                                document.getElementById('_id_').value = '';

*/

                            }

                        });

                    }

                    return false;

                });

            });

        </script>

It works,'cause I have following html input box:




 <textarea cols="30" rows="2" style="width:480px;font-size:14px; font-weight:bold" id="_id_" maxlength="145" ></textarea>



As u can see, jquery will take [size="2"]id=id in order to use AJAX[/size]

I try to realize same thing with yii2, but I get following error:





bewerber_update?id=2:1925 Uncaught TypeError: Cannot set property 'value' of null

    at Object.success (bewerber_update?id=2:1925)

    at fire (jquery.js:3187)

    at Object.fireWith [as resolveWith] (jquery.js:3317)

    at done (jquery.js:8757)

    at XMLHttpRequest.<anonymous> (jquery.js:9123)



This error will be thrown out,’ cause I don’t konw, how to set id correctly in yii2. I tried like this, but this is obviously the wrong way:





    <?=

    $form->field($model, 'beurteilung_fachlich')->widget(\dosamigos\ckeditor\CKEditor::className(), [

        'id'=>'_id_',

        'options' => ['rows' => 1],

        'preset' => 'full'

    ])

    ?>



Any ideas, how to set id in a correct way?

under

have


data: 'id=' + variable_used_holding_id,




<?=

    $form->field($model, 'beurteilung_fachlich')->widget(\dosamigos\ckeditor\CKEditor::className(), [

        'options' => ['rows' => 1, 'id'=>'_id_'],

        'preset' => 'full'

    ])

?>



This helped me, again. Thx a lot for this

I know,it’s already second time, U were able to solve my problem.

Where do you know all this "configuration settings" of yii2?

If you wrote a book about this framework, I’d buy it at once!

Here ;)