X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..10a866c12701c0a0afd0ac85dcdcf32a421514ac:/docs/source/ScriptTagProxy.html diff --git a/docs/source/ScriptTagProxy.html b/docs/source/ScriptTagProxy.html index 8b3b4f1f..c2e1f3df 100644 --- a/docs/source/ScriptTagProxy.html +++ b/docs/source/ScriptTagProxy.html @@ -1,5 +1,6 @@
+Below is a PHP example to do the same thing:
+$callback = $_REQUEST['callback'];
+
+// Create the output object.
+$output = array('a' => 'Apple', 'b' => 'Banana');
+
+//start output
+if ($callback) {
+ header('Content-Type: text/javascript');
+ echo $callback . '(' . json_encode($output) . ');';
+} else {
+ header('Content-Type: application/x-json');
+ echo json_encode($output);
+}
*
* @constructor
@@ -109,7 +125,7 @@ Ext.extend(Ext.data.ScriptTagProxy, Ext.data.DataProxy, {
* this
reference) in which the callback function is executed. Defaults to the browser window.
* @param {Object} arg An optional argument which is passed to the callback as its second parameter.
*/
doRequest : function(action, rs, params, reader, callback, scope, arg) {
@@ -167,12 +183,12 @@ Ext.extend(Ext.data.ScriptTagProxy, Ext.data.DataProxy, {
}
};
},
- /**
+ /**
* Callback for read actions
* @param {String} action [Ext.data.Api.actions.create|read|update|destroy]
* @param {Object} trans The request transaction object
* @param {Object} res The server response
- * @private
+ * @protected
*/
onRead : function(action, trans, res) {
var result;
@@ -196,30 +212,30 @@ Ext.extend(Ext.data.ScriptTagProxy, Ext.data.DataProxy, {
}
trans.callback.call(trans.scope||window, result, trans.arg, result.success);
},
- /**
+ /**
* Callback for write actions
* @param {String} action [Ext.data.Api.actions.create|read|update|destroy]
* @param {Object} trans The request transaction object
* @param {Object} res The server response
- * @private
+ * @protected
*/
- onWrite : function(action, trans, res, rs) {
+ onWrite : function(action, trans, response, rs) {
var reader = trans.reader;
try {
// though we already have a response object here in STP, run through readResponse to catch any meta-data exceptions.
- reader.readResponse(action, res);
+ var res = reader.readResponse(action, response);
} catch (e) {
this.fireEvent('exception', this, 'response', action, trans, res, e);
trans.callback.call(trans.scope||window, null, res, false);
return;
}
- if(!res[reader.meta.successProperty] === true){
+ if(!res.success === true){
this.fireEvent('exception', this, 'remote', action, trans, res, rs);
trans.callback.call(trans.scope||window, null, res, false);
return;
}
- this.fireEvent("write", this, action, res[reader.meta.root], res, rs, trans.arg );
- trans.callback.call(trans.scope||window, res[reader.meta.root], res, true);
+ this.fireEvent("write", this, action, res.data, res, rs, trans.arg );
+ trans.callback.call(trans.scope||window, res.data, res, true);
},
// private