The next step is to create a script that jQuery DataTables can call, and subsequently returns the requested data in JSON format. This action script (/path/to/repo/www/chapter_06/ajax.py) makes use of both the products domain service as well as the new JSON responder class discussed in the previous sections.
As with the other web scripts we've described so far, we add an initial tag that tells the web server's CGI process how to run the script. We then perform the appropriate imports:
#!/usr/bin/python
import os,sys
src_path = os.path.realpath('../../chapters/06/src')
sys.path.append(src_path)
from config.config import Config
from web.responder.json import JsonResponder
from web.auth import SimpleAuth
from db.mongodb.connection import Connection
from sweetscomplete.domain.product import ProductService
from sweetscomplete.entity.product import Product
Next, we use the new Config class to create the Connection, Product, and ProductService...