Tell me how in opencart2 to accept the data in the model, I have a form
<form action="" method="post"> <table class="table table-bordered table-striped"> <thead class="thin-border-bottom"> <tr> <th style="width: 10%;"> <i class="ace-icon fa fa-caret-right blue"></i><?php echo $text_id ;?> </th> <th> <i class="ace-icon fa fa-caret-right blue"></i><?php echo $text_name_category ;?> </th> <th class="hidden-480"> <i class="ace-icon fa fa-caret-right blue"></i><?php echo $text_status_category ;?> </th> <th style="width: 8%"> <i class="ace-icon fa fa-caret-right blue"></i><?php echo "Изменить" ;?> </th> </tr> </thead> <?php foreach ($category as $category){ ?> <tbody> <tr> <td><?php echo $category['category_id']?></td> <input type="hidden" name="category_id" id="category_id" value="<?php echo $category['category_id'];?>"> <td><?php echo $category['name'];?></td> <?php if($category['status'] == 1){ ?> <td class="hidden-480"> <span class="label label-info arrowed-right arrowed-in"><?php echo $text_on ;?></span> </td> <?php } else { ?> <td class="hidden-480"> <span class="label label-info arrowed-right arrowed-in"><?php echo $text_off ;?></span> </td> <?php } ?> <td> <center><button class="btn btn-xs btn-danger" id="<?php echo $category['category_id'];?>" type="button" data-toggle="modal" data-target="#myEdit" onclick="give(this.id)" > <i class="ace-icon fa fa-edit bigger-120"></i> <span class="bigger-110"></span> </button></center> </td> </tr> </tbody> <?php } ?> </table> </form> so i get the category id
<script> function give(val) { var obj = document.getElementById('block'); $.ajax({ type: 'POST', url: '/index.php?route=product/category', data: val, success: function (data) { console.log(val); } }); } in the console, when I click a button, they receive id 85, 82, etc. I cannot understand how to write the received data; when I did print_r ($ _ POST) in the controller, nothing happens, and I do not know what comes in the post-e, tell me how it can be done.
data: 'id='+val- vp_arth