| Package: | Ext.data |
| Class: | ScriptTagProxy |
| Extends: | Object |
| Defined In: | ScriptTagProxy.js |
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 DataProxy.
The content passed back from a server resource requested by a ScriptTagProxy is executable JavaScript
source code that 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:
boolean scriptTag = false;
String cb = request.getParameter("callback");
if (cb != null) {
scriptTag = true;
response.setContentType("text/javascript");
} else {
response.setContentType("application/x-json");
}
Writer out = response.getWriter();
if (scriptTag) {
out.write(cb + "(");
}
out.print(dataBlock.toJsonString());
if (scriptTag) {
out.write(");");
} | Method | Defined By | |
|---|---|---|
ScriptTagProxy( Object config ) |
ScriptTagProxy | |
| abort() : void | ScriptTagProxy | |
| Abort the current server request. | ||
load( Object params, Ext.data.DataReader reader, Function callback, Object scope, Object arg ) : void |
ScriptTagProxy | |
| Load data from the configured URL, read the data object into a block of Ext.data.Records using the passed Ext.data.Da... | ||
| Config Options | Defined By | |
|---|---|---|
| callbackParam : String | ScriptTagProxy | |
| (Optional) The name of the parameter to pass to the server which tells the server the name of the callback function s... | ||
| nocache : Boolean | ScriptTagProxy | |
| (Optional) Defaults to true. Disable cacheing by adding a unique parameter name to the request. | ||
| timeout : Number | ScriptTagProxy | |
| (Optional) The number of milliseconds to wait for a response. Defaults to 30 seconds. | ||
| url : String | ScriptTagProxy | |
| The URL from which to request the data object. | ||
public function ScriptTagProxy( Object config )
config : Objectpublic function abort()
voidpublic function load( Object params, Ext.data.DataReader reader, Function callback, Object scope, Object arg )
params : Objectreader : Ext.data.DataReadercallback : Functionscope : Objectarg : ObjectvoidcallbackParam : String
The server-side processing must read this parameter value, and generate javascript output which calls this named function passing the data object as its only parameter.
nocache : Boolean
timeout : Number
url : String