I want to send a list ($data = [“1″,”2”];) to the controller from the view, and the result (1 2) be shown on the console,
but my code shows the code source of the view page! not the list $data
CHECK THE IMAGE:
MY CODE :
———
Controller:
public function deliverySetup(){
if(isset($_POST['request'])){
$request = $_POST['request'];
if($request == 'deliverySetup'){
$data = ["1","2"];
$this->view("control/hajar", $data);
}
}
}
View:
function deliverySetup(){
$.post('<?php echo URLROOT ?>' + 'Scan/deliverySetup', {request: 'deliverySetup'}, function (data) {
console.log(data);
});
}