| Page 1 of 1 | [ 1 post ] |
|
I want to parse a response string and save it as JSON like the follows:
Code: YAHOO.util.Connect.completeEvent.subscribe(function(eventType, args) { args = args || []; var o = args.length ? args[0] : {}; var responseText = o.conn.responseText; if (responseText) { try { responseText = lang.JSON.parse(responseText); } catch (e) { responseText = {}; } } else { responseText = {}; } o.conn.responseText = responseText; // the problem is here }); But unfortunately when I save 'responseText' variable in o.conn.responseText I don't get a parsed JSON object, so in success callback function I have to do JSON.parse again; Code: success: function (o) { var r = lang.JSON.parse(o.responseText); What's wrong in my code above? I want to get parsed JSON object in success callback function. Is it possible? |
| Page 1 of 1 | [ 1 post ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group