PDA

View Full Version : Question on Cross-domain Ext.Ajax ?



duskandawn
30 Nov 2010, 6:26 PM
Hello All,
I am using ext 3.2.1 and trying to use Animal's override for Ext.Ajax mentioned on this thread:
http://www.sencha.com/forum/showthread.php?17691-Cross-domain-Ext.Ajax-Ext.data.Connection/page2

I have the scenario where i dont have the access to the third party server which is sending back the json data, and hence it arrives without a callback attached to it.
When trying to use the the override i see, the invalid label error for the json response which looks like:
{"Type":6,"name":"xxyy"}
My question is i guess is there any way i can intercept this data before it being added to the document as javascript, and add the necessary '(' ')', the reason being since the request was successful and i do see the response back in firebug , i am not that keen on the json format response as such, even if i need to parse the response-text thats fine with me,
But am not sure, if there any way from client side, to just read the response somehow.
I also read about the server side solution to use my server as proxy to make the call to the other server,
can someone elaborate on this technique, i have a servlet present on my server, can i somehow use that to proxy the request, but not sure how to move forward.
Any help will be much appreciated.

Thanks a lot,

mankz
1 Dec 2010, 12:24 AM
No clean way to do that I'm afraid, the problem is that the response isn't wrapped in a callback function. Either create your own server proxy to grab the data or try something like this: http://jsonpwrapper.com/ (not recommended :) )

duskandawn
1 Dec 2010, 5:42 AM
Thanks Mankz,
Let me the proxy server side, seems move familiar to me. I did look into the JSONWrapper thing, did quiet understand to how to use. BUt was just a shot, in case it comes handy sometime.
Any ideas how to use it, just for knowing purposes.

Thanks,