I need an advice on my first website practice

Hello, lets imagine that you are trying to create a web page where you have an empty html

element, mysql db, and running xampp server.
You want to retrieve data from the db, pass it (I guess through php, because it’s server-side language) to javascript (or directly to the html p-element), and want this p-element to be refreshed on button click (every click replaces the current p-element text).
What technology would you choose to achive such goal? Ajax? Nodejs? Xmlhttprequests? Or maybe go to python/django? Or php/xampp (I’ve chosen it)?.
Could you give any suggestion to a begginer like me what direction to move? What technology is more suitable in this case?
Thanks.

Personally I run Node and Express with MongoDB, I found some tutorials on YouTube, followed them, then built my own back end.

1 Like

My advice is the same as @austinmoore1492 'cause the MEAN stack is very powerful and light weight. Otherwise you can use AJAX for retrieving that data and pass it through the p-element without using php and get under the js environment. :wink:

1 Like

Hi, since you are using a xampp stack, I’d go with PHP.
Within the JavaScript function triggered by the onClick event, you can make a request to a PHP.
This .php file will check for any paramaters (if you use them) passed (usually with a POST request), retrieve data from the db and echo a JSON answer.
This answer will be what the JavaScript reads. You can use Ajax for this and than you use what you got to change the p element.

Happy coding :slight_smile:

1 Like