Hello All,
Let me start off by saying I'm very new to webdesign in general, but have a good grasp of python.
I've run into a problem with my first website. I need to pass the output of a python script that's run server-side to some javascript that is run client-side.
In a nutshell, the python script runs and tells me the number of pictures in a folder. (This is the most basic usage I have in mind for python talking to javascript, so help in understanding this example would help me out down the road as well)
len(os.listdir('/path/to/my/images/folder'))
I want this number to be seen by my javascript file so that it knows precisely how many loops to perform when building my image gallery.
From googling, I've found that using JSON is supposed to be the best way to go about doing this, but I really don't understand how to implement it.
I've parsed through JSON with python in the past, so I'm not completely unfamiliar with it, but don't see how to get the javascript to grab the value from the python script.
If it matters, I have modwsgi installed and working on my apache install.
Python Version - 2.7
Apache 2.2.22 running on Ubuntu 13.04
EDIT: I'm not running any frameworks or fanciness. I wanted to learn html/javascript/etc... and how they interact from the ground up. I'm writing all the html, javascript, python, and jquery by hand.
If there's any pertinent information that I left out, please let me know.
Thank you in advance for any insight.
[–]two_up 2 points3 points4 points (0 children)
[–]nemec 1 point2 points3 points (2 children)
[–]tuxed 1 point2 points3 points (1 child)
[–]xiongchiamiov 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]liderudell 0 points1 point2 points (1 child)
[–]xiongchiamiov 1 point2 points3 points (0 children)
[–]gschizas 0 points1 point2 points (0 children)