On Jan 21, 2008 12:45 AM, wavydavy <[EMAIL PROTECTED]> wrote: > > On Jan 20, 10:54 pm, "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> wrote: > > I'm trying to get the client to send data to the server with this > > MochiKit/Javascript function.... > > > > (I got latest SVN source for MochiKit that has doXHR.) > > > > function send_data() { > > var d = doXHR("/chat/print_data", > > {method : "POST", > > sendContent : queryString({"apple" : > > "orange"}), > > }); > > d.addCallback(success_handler); > > d.addErrback(failure_handler); > > > > } > > > > I'm trying to send it to the print_data method show below.... > > > > @turbogears.expose() > > def print_data(self, the_data): > > open("/output_file", "w").write(the_data) > > > > Why do I get this error message about wanting more params?.... > > Try: > > def print_data(self, apple): > open("/output_file", "w").write(apple) > > IIRC, TG strips non-keyword args from query strings when calling the > controller.
You probably also have to specify 'Content-type': 'application/x-www-form-urlencoded' in the doXHR call so that the server knows how to parse your data. -bob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to turbogears@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---