PDA

View Full Version : Loading CrossSite JSON



xonixx
9 Nov 2009, 6:31 AM
Hi,

can anoyne post a little code snippet for an javascript wrapper ?

Maybe is it possible to load JSON without a wrapper ?

mschwartz
9 Nov 2009, 6:54 AM
See Ext.data.ScriptTagProxy in the online docs.

xonixx
9 Nov 2009, 7:00 AM
Thats an java example :D

javascript =! java

mschwartz
9 Nov 2009, 8:19 AM
ScriptTagProxy uses <script> tag to load cross site Json FROM JAVASCRIPT.

xonixx
9 Nov 2009, 1:56 PM
I build my application like the example but why did i get the error invalid label ?


http://www.extjs.com/deploy/dev/examples/form/forum-search.html

evanc
9 Nov 2009, 2:46 PM
if you built it exactly like the example, it would work. What did you change?

My guess: you're not generating a script.

xonixx
9 Nov 2009, 3:00 PM
Where should i generat a Script on the Serverside ? In the example i see nothing that can help me :( maybe im blind :">

aw1zard2
9 Nov 2009, 3:17 PM
Note that if you are retrieving data from a page that is in a domain that is NOT the same as the originating domain of the running page, you must use this class, rather than HttpProxy.

The content passed back from a server resource requested by a ScriptTagProxy must be executable JavaScript source code because it is used as the source inside a <script> tag.

In order for the browser to process the returned data, the server must wrap the data object with a call to a callback function, the name of which is passed as a parameter by the ScriptTagProxy. Below is a Java example for a servlet which returns data for either a ScriptTagProxy, or an HttpProxy depending on whether the callback name was passed:
From the docs.

http://www.extjs.com/deploy/dev/docs/?class=Ext.data.ScriptTagProxy (http://www.extjs.com/forum/../deploy/dev/docs/?class=Ext.data.ScriptTagProxy)

In the example topics-remote.php is doing this.
(http://www.extjs.com/forum/../deploy/dev/docs/?class=ScriptTagProxy)

xonixx
10 Nov 2009, 1:37 AM
Thanks mate !

it was my mistake, i used the wrong store... but now when im using Ext.data.Store it works.

:D