Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I call controller/method inside button onclick?

Tags:

codeigniter

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>
like image 525
user3251408 Avatar asked Nov 28 '22 01:11

user3251408


1 Answers

Try this code:

<button type="button" class="btn btn-success" onclick="window.location='<?php echo site_url("controller/fun_name");?>'">Sign Up</button>
like image 159
Kumar V Avatar answered Dec 20 '22 18:12

Kumar V