I'm refactoring our application to handle many of the repetitive tasks closer to (or within) the framework. One of those repetitive tasks is the decoding of the responseText to JSON.
I'm considering using ext-basex and modifying it (either the code itself or via runtime extension) to handle this task. It seems that adding a responseJson attribute to the response object, and populating it within createResponseObject(), would do the trick.
Have you considered this enhancement? Does this seem like the appropriate place to handle this?
On a related note, is your response object available to Ext.Ajax, or do I need to directly use your Ext.lib.Ajax?
@jlowe -- I had considered that earlier but was concerned about the potential response 'analysis' overhead. Thinking about more tho, now that you've brought it up again, it's certainly doable if the response's Content-Type contains '*/json'? Short of that, an expensive attempt would have to be made to determine if the response was JSON.
On a related note, is your response object available to Ext.Ajax, or do I need to directly use your Ext.lib.Ajax?
No, all ext-basex enhancements to Ext.lib.Ajax and the responseObject (thus Ext.data.Connection) are transparent, so it would flow throughout the Ext framework.
... it's certainly doable if the response's Content-Type contains '*/json'? Short of that, an expensive attempt would have to be made to determine if the response was JSON.
I believe that would be consistent with the XHR object, which populates responseXml if the Content-Type specifies XML. No need for further overhead.
Hi all, i've problem with ModuleManager.
It works fine, great solution for my app. But i have problem with charset.
I've russian text in loaded files, and charset is windows-1252 - it is possible to set utf-8?
i want to use Ext.lib.Ajax.onStatus to deal with the situation that the server check session timeout,and give a http 302 or 401 and so on status.could any one give me a help?thanks
I'm also greatly in favor of responseJson. It'll be a lifesaver, since I have to decode it in EVERY callback.
Relying that much on content type is probably not such a good idea, since not everyone can set it.
Hi all, i've problem with ModuleManager.
It works fine, great solution for my app. But i have problem with charset.
I've russian text in loaded files, and charset is windows-1252 - it is possible to set utf-8?
@Digital God -- If you are loading a resource via a standard XHR request(GET, POST) the browser always assumes the response is going to be UTF-8. You server should encode the response as UTF-8 prior to sending it (or save your file with UTF-8 encoding before serving it up).