I am using CodeIgniter and my js code is in my "view" and I want to pass the value in my controller.
var storage =[];
function something()
{
storage.push('the value');
}
Now I want a better way to pass the storage array into my PHP. Thanks in advance. This code is not working because it is in the separate folder.
$.ajax({
    url: 'yourPHPFile.php',
    type: 'POST',
    data: {data:storage.toString()},
    success: function(result) {
            // handle your success
    },
    error: function() {
      // alert("error");
    }
});
 
     
     
     
    