--
Consider asking HOWTO questions at Stack Overflow: http://stackoverflow.com/tags/dart
I am trying to send data from Dart app to google-app-engine server. I have been trying many things but nothing worked till now.
Here is the Dart code:
void sendData(String data) {
HttpRequest request = new HttpRequest(); // create a new XHR
// add an event handler that is called when the request finishes
request.onReadyStateChange.listen((_) {
if (request.readyState == HttpRequest.DONE &&
(request.status == 200 || request.status == 0)) {
// data saved OK.
print("succesfully posted data");
print(request.responseText); // output the response from the server
}
});
// POST the data to the server
var url = "http://xyz.appspot.com/";
request.open("POST", url, async: false);
request.send(data); // perform the async POST
}
This code works and I have no problem in it. This is my server side function which is in python:
def post(self):
#session= self.request.get('Session' , DEFAULT_SESSION_KEY)
session= DEFAULT_SESSION_KEY
Components = Circuit_Components(parent=session_key(session))
Components.components = self.request.get(self.request.arguments()[0])
Components.put()
query_params = {'Session': session}
self.redirect('/?' + urllib.urlencode(query_params))
Would anyone help me in this.
Thanks
Asmaa
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new