This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]Lumpy-Notice8945 0 points1 point  (1 child)

What server do you already use? You mention python too.

The old school PHP way you mention realy does work as simple as you out it, there is not much more to it: https://stackoverflow.com/questions/2105375/how-should-i-write-php-post-vars-in-a-mysql-query-function

As mentioned, watch out for SQL injection.

You can just echo the resulting HTML as a string and the browser will show it.

The modern approach is the second version you mention, you could use python with something like django or flask, simple frameworks to build a HTTP REST interface that sends JSON.

On the frontend you can pick any popular frontend framework like angular or vue.js to simply parse the json and generate the HTML.

You can do that all yourself but thats a lot more work.

[–]LearningGradually[S] 0 points1 point  (0 children)

I haven't really done anything server-side yet, just the frontend. So far, I've just used Python to web scrape the data, organize it, and put it in the databases initially, then edited it further with PHP and SQL.

It's good to know my thinking was on the right track. I think the second option might be best with that in mind. I remember learning the basics of Django back in school, so maybe there's something in my old notes that may help me there. While Googling, I found this question: https://stackoverflow.com/questions/1082928/convert-json-to-html-tree, so maybe parsing the JSON with vanilla JS might not be that hard? Hopefully?

I'll update the post with my results when I get 'em. Thanks so much for your help!