PDA

View Full Version : Getting to original XMLHttpRequest#responseText from a store?



PulpMysteryFan
18 Jul 2012, 6:51 AM
Hi everyone.

Does anyone know how to get the XMLHttpRequest#responseText from a data store? The situation is that my server provides additional meta data in the response that I need to get to later. My code is called after the store has been filled. The data from the server looks something like this:

{
success: true,
records: [],
meta: {}
}

Thanks! :-)

Tim Toady
18 Jul 2012, 9:10 AM
It gets stored on your reader. So store.getProxy().getReader() and then you would want the rawData or jsonData property.

PulpMysteryFan
18 Jul 2012, 9:39 AM
Thanks!

:-D

amaccann
12 Sep 2012, 4:40 AM
Bumping this question because it's related to my own issue: can you grab the raw data if the returned JSON doesn't contain the root specified in the reader?

ordinarily our store URL returns { success: true, game: { ... } } data, with rootProperty being 'game', but exceptions thrown by the server return an object without the game object - is there still a way to grab this raw data anyway?

Tim Toady
12 Sep 2012, 11:03 AM
It should still be there despite your root missing assuming you are returning valid json. Is the error complaining about json?