How can I call controller/method inside button onclick?

codeigniter

Solution

you can use like this,

<button type="button" class="btn btn-success" 
        onclick="<?php echo base_url()?>controller/function">Sign Up</button>

Problem

I want to call a controller with method onclick. I solved this, but I want to find a solution for this. ``` <button type="button" class="btn btn-success" onclick="<?php ?>">Sign Up</button> ```

Original source