Welcome Guest, Not a member yet? Register   Sign In
Onclick does nothing
#5

(05-13-2019, 10:58 AM)Deborah Wrote: Useful thanks, understand more now about server(php)/client(js).  I tried below, which adds a row when the page loads, but not with onclick.  Dunno how to use js to send a request to php, which should be simple even for novice.

<script>
function add_row() {
<?php $this->table_model->add_row( 'file.doc' ); ?>
}
</script>

<a href="http://downloadfiles.com/file.doc" onclick="add_row()">

To learn how to use JS to send a request to php google "jquery get and post". If you don't want to use JS you could create a form that just has a submit button with the action attribute specifying a codeigniter controller. Then in the controller you call your model function to add the row to your table.
Simpler is always better
Reply


Messages In This Thread
Onclick does nothing - by Deborah - 05-13-2019, 09:17 AM
RE: Onclick does nothing - by ciadmin - 05-13-2019, 09:41 AM
RE: Onclick does nothing - by albertleao - 05-13-2019, 09:58 AM
RE: Onclick does nothing - by Deborah - 05-13-2019, 10:58 AM
RE: Onclick does nothing - by donpwinston - 05-13-2019, 03:25 PM
RE: Onclick does nothing - by albertleao - 05-13-2019, 03:33 PM
RE: Onclick does nothing - by Wouter60 - 05-13-2019, 11:10 PM
RE: Onclick does nothing - by albertleao - 05-14-2019, 10:52 AM
RE: Onclick does nothing - by Deborah - 05-16-2019, 10:31 AM
RE: Onclick does nothing - by albertleao - 05-16-2019, 12:02 PM
RE: Onclick does nothing - by Deborah - 05-16-2019, 01:28 PM
RE: Onclick does nothing - by albertleao - 05-17-2019, 07:01 AM
RE: Onclick does nothing - by Deborah - 05-17-2019, 07:20 AM
RE: Onclick does nothing - by shivambhatele - 06-23-2019, 09:43 PM
RE: Onclick does nothing - by MattZand - 09-17-2019, 02:44 PM
RE: Onclick does nothing - by InsiteFX - 07-04-2021, 02:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB