I used the second approach:
web.header('Content-Type', 'application/json')
And it worked great! Thanks for the help.-- Bruce Eckel www.Reinventing-Business.com www.MindviewInc.com On Fri, Sep 23, 2011 at 11:00 AM, Sergei Sadovski <[email protected]>wrote: > > In the CoffeeScript callback function, I'm thinking I should be able to > > select the elements of the JSON object by saying "result.txt" and > > "result.dat" but that doesn't work, so I'm guessing I haven't really > created > > a JSON object, just a string. Or I've missed some other step or point. > > Set dataType[1] in your $.post() function to "json". > > or > > set response content type to "application/json" as: > > web.header('Content-Type', 'application/json') > return json.dumps(dict( # Sort of seems to do the right thing... > txt = input.mod.lower(), > dat = "%.3f" % float(input.num) > )) > > > [1] http://api.jquery.com/jQuery.post/ > > -- > Best regards, > Sergei Sadovski > > -- > You received this message because you are subscribed to the Google Groups > "web.py" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/webpy?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.
