0

I am trying to make an html app for local use, consisting of an HTML page using Google Maps API V3, a SQLite database, and a SimpleHTTPServer script.

The workflow is the following:

  1. User starts the server and opens the page, which contains a map with a set of markers, and a form with filters similar to those of Google Fusion Tables;
  2. User interacts with form, which sets some parameters for a query;
  3. When the user clicks "Submit", page sends a request to HTTPServer, whose request handler queries the SQLite database and returns the result as JSON/JSONP/something-else;
  4. Some function takes back the data and map is updated;

My doubts are more conceptual than anything else, and specifically I would like to know (how/where to look for):

  • How should I send a request for the server in javascript, and how to listen back to it?
  • How should the server send data to the request, in order to update its value instead of refreshing the page?

Sorry if my questions seem obvious, but HTTP is something very new to me, and so is client-server communication.

Thanks for reading!

1 Answer 1

1

I think you can use CGIHTTPServer.
ref:
http://pydoc.org/2.5.1/CGIHTTPServer.html

Q:How should I send a request for the server in javascript, and how to listen back to it
A:Please google "ajax". "jquery" is one of the most convenient javascript library for ajax.

Q:How should the server send data to the request
A:just use "print" in python script which is called by CGIHTTPServer.

In this case, the output of "print" will be the response to http client(web browser).
In the script mentioned above, you should extract request parameter sent by http client,
with "do_Get()" or do_Post() function.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.