Apologies up front for the noob question...
Hello, how do I get data from the Python end of an appengine server using jQuery.ajax? I know how to send data to the server using ajax and an appropriate handler, but I was wondering if someone could tell me what the ajax request for getting values from the server looks like. (Suppose I wanted to get a number from the datastore and use it in the javascript).
client sending to server (using jquery)
client-side javascript:
//jQuery and ajax function loaded.
<script type="text/javascript">
var data = {"salary":500};
$.ajax({
type: "POST",
url: "/resultshandler",
data: data
</script>
server-side:
class ResultsHandler(webapp.RequestHandler):
def get(self):
n = cgi.escape(self.request.get('salary'))
e = Engineer(salary = n)
e.put()
and under def main():, I have the handler ('/put_in_datastore', ResultsHandler)
Again, what would be the similar code for retrieving numbers from the Python end? If someone could provide both the handler code and javascript code that would be great...