mod_python json

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cparora
    New Member
    • Feb 2008
    • 2

    mod_python json

    Hi All,
    I am trying to create json (dictionary) in java script and sending it mod_python by ajax. How would i able to access this json by request object. Please see example.

    javascript send dict as

    var obj1 = {'EMP': [{'MGR': 7839, 'JOB': 'CLERK', 'DEPTNO': 10, 'EMPNO': 7934, 'SAL': 1000.0}, {'MGR': 7839, 'JOB': 'CLERK', 'DEPTNO': 10, 'EMPNO': 7934, 'SAL': 1000.0}, {'MGR': 7839, 'JOB': 'CLERK', 'DEPTNO': 10, 'EMPNO': 7934, 'SAL': 1000.0}, {'MGR': 7839, 'JOB': 'CLERK', 'DEPTNO': 10, 'EMPNO': 7934, 'SAL': 1000.0}, {'MGR': 7839, 'JOB': 'CLERK', 'DEPTNO': 10, 'EMPNO': 7934, 'SAL': 1000.0}, {'MGR': 7839, 'JOB': 'CLERK', 'DEPTNO': 10, 'EMPNO': 7934, 'SAL': 1000.0}, {'MGR': 7839, 'JOB': 'CLERK', 'DEPTNO': 10, 'EMPNO': 7934, 'SAL': 1000.0}, {'MGR': 7839, 'JOB': 'CLERK', 'DEPTNO': 10, 'EMPNO': 7934, 'SAL': 1000.0}, {'MGR': 7839, 'JOB': 'CLERK', 'DEPTNO': 10, 'EMPNO': 7934, 'SAL': 1000.0}, {'MGR': 7839, 'JOB': 'CLERK', 'DEPTNO': 10, 'EMPNO': 7934, 'SAL': 1000.0}, {'MGR': 7839, 'JOB': 'CLERK', 'DEPTNO': 10, 'EMPNO': 7934, 'SAL': 1000.0}, {'MGR': 7839, 'JOB': 'CLERK', 'DEPTNO': 10, 'EMPNO': 7934, 'SAL': 1000.0}, {'MGR': 7839, 'JOB': 'CLERK', 'DEPTNO': 10, 'EMPNO': 7934, 'SAL': 1000.0}, {'MGR': 7839, 'JOB': 'CLERK', 'DEPTNO': 10, 'EMPNO': 7934, 'SAL': 1000.0}]};

    xmlhttpRequest. send("para1"=ob j1)

    in the python function

    def x(req):
    t=req.form["para1"]
    v=t["EMP"][0]["JOB"]

    this doe not work
Working...