Welcome Guest, Not a member yet? Register   Sign In
Called method in controller does not execute anything of a ajax-added field is submit
#2

Okay, I did it Big Grin
The reason was, that the changed CSFR key was only used within AJAX. A new given key has to be also in the main form. I just added one
Code:
$("input[name=cappx]").val(data.hash)
line in my success-function so that the JS-code looks like this now:

Code:
    <script type="application/javascript">

        var cappx = "<?= $csfrManually ?>"

        function getDropdown(csfr = cappx) {

            var data = {
                cappx: csfr,
                action: document.getElementById("massEdit").value
            }

            $.ajax({
                url: '/collection/api/getMassEditList',
                type: 'post',
                dataType: 'json',
                data: data,
                success:function(data) {
                    cappx = data.hash
                    $("input[name=cappx]").val(data.hash);

                    document.getElementById("newXDropdown").innerHTML = data.target
                }
            });

        }
    </script>
Reply


Messages In This Thread
RE: Called method in controller does not execute anything of a ajax-added field is submit - by sprhld - 04-29-2022, 03:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB