javascript - Execute function on button click Codeigniter -


i new codeigniter. want create button in view when clicked execute function controller.

i using right code in view:

<button id="checkin" onclick="location.href=' <?php echo base_url();?>index.php/daily_attendance/check_in'">check in</button> 

this code not execute function check_in, me page. can use redirect() in controller of function , wherever want.

the problem have jquery hide button on click , show button. when execute function redirect, page refresh , button not shown.

my question that, there better way execute functions without going page in codeigniter?

is there way pass function button or should make button in controller not advisable since it's not ui components , because need create many views manage ui since button in middle of page?

this way can call function of controller on button click.

<a href="<?php echo base_url(); ?>daily_attendance/check_in/<?php echo $stdrow->student_id;  ?>"  class="btn red" style="height: 20px; border-radius:4px;">check in</a> 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -