CodeIgniter Forums
Onclick does nothing - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Onclick does nothing (/showthread.php?tid=73605)

Pages: 1 2


RE: Onclick does nothing - Deborah - 05-16-2019

Also tried:

<script>
function add_row_js() { <?=site_url('download_page/add_row')?> }
</script>
<a href="http://www.downloaddocs/file.doc" onclick="add_row_js();">

which does download the file, but doesn't call the add_row() in the Controller class to run a query.
Could be the main developer doesn't want me to work on his site and has set it up so function calls will never work on the page I was assigned to </sad face>.


RE: Onclick does nothing - albertleao - 05-17-2019

Deborah, I recommend and going back and doing some tutorials on html, javascript, and php. Everything you've shown here indicates that if coded correctly, your function would work just fine.

The html you're using above won't work because it's not being written correctly. I'd recommend something like https://www.w3schools.com/html/ to get started.

The javascript you posted above is still incorrect and doesn't do anything. I'd recommend getting started with https://www.learn-js.org/ to get the basics of javascript.

For your php and back end, there are hundreds of resources, but I'd recommend some youtube videos that have some visuals to depict the difference between backend and frontend.

I'd slow down the roll on trying to blame the 'main developer' until you've written working code that is not working, but for the time being, it's just code that won't work in any environment.


RE: Onclick does nothing - Deborah - 05-17-2019

Wonder why Albert has repeated the same thing 3 times, "my code is wrong and need to learn how to code", which useful in the long-term but useless for my boss who has waited 6 days for me to write 1 line of code that updates a table. Sounds a bit trollish to provoke an argument, anyways thanks for the helpful comments guys, I'm off to StackOverflow where fingers-crossed I might get some code examples I can work backwards from.


RE: Onclick does nothing - shivambhatele - 06-23-2019

I agree with albertleao going back and doing some tutorials on HTML, javascript, and PHP. I am also learning some coding difficulty and follow one of the online programming community.
For javascript resource check this - https://hackr.io/tutorials/learn-javascript


RE: Onclick does nothing - MattZand - 09-17-2019

I also suggest learning JS. Here is a simple game for learning JS very quickly: https://myhsts.org/tutorial-build-guess-the-number-game-with-javascript.php


RE: Onclick does nothing - justiceankomah - 07-03-2021

I understand your point but I think that must be a javascript error. Is not a server error, so check your DOM element. I wrote about how the DOM element interacts with the server in my coding tutorials blog https://tutorialscamp.com/


RE: Onclick does nothing - InsiteFX - 07-04-2021

w3schools - jQuery Tutorial