jquery get url for ajax in yii framework

other
voted: 0
vote
ajax url yii2

Get url for subit values from view to php using ajax in Yii framework

<?php
    $baseUrl = Yii::$app->request->BaseUrl;
?>

<script type="text/javascript">
    document.addEventListener("DOMContentLoaded", function (event) {
        $(document).on('click', "#add_dimension", function (e) {
            var priceTableId = '<?= $priceTable ?>';
            var form_data = {
                    //data for submit here
            };

            $.ajax({
                dataType: "json",
                url: '<?php echo $baseUrl ?>' + '/price-table/add-dimension',
                type: 'POST',
                cache: false,
                data: form_data,
                success: function (response) {
                        //code on succes here
                }

            });
            return false;
        });
    });
</script>
working url: not entered
version: not entered
Leave a Comment:
Characters left:
No comments yet.