Can't request JSON data correctly

1 view
Skip to first unread message

Providence

unread,
Nov 19, 2009, 10:29:15 PM11/19/09
to MooTools Users
I can't seem to parse the data return via this Request. I think I'm
not requesting JSON data correctly.


http://pastie.org/707111

Steve Onnis

unread,
Nov 19, 2009, 10:48:57 PM11/19/09
to mootool...@googlegroups.com
Try

onComplete: function(rs){
var rs = JSON.decode(rs);
var el = new Element('tr');
var start = new Element('td', {'html': rs.start}).inject(el);
var end = new Element('td', {'html': rs.end}).inject(el);
var student_count = new Element('td', {'html':
rs.student_count+'Student/s'}).inject(el);
var price = new Element('td', {'html': rs.price}).inject(el);

el.inject($('schedules'));

Providence

unread,
Nov 19, 2009, 10:58:31 PM11/19/09
to MooTools Users
Nice. I did try JSON.encode. never occurred to me that I should have
used JSON.decode.

Thanks a lot Steve.
Reply all
Reply to author
Forward
0 new messages