3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js"><div id="cls-Ext.direct.JsonProvider"></div>/**
\r
9 * @class Ext.direct.JsonProvider
\r
10 * @extends Ext.direct.Provider
\r
12 Ext.direct.JsonProvider = Ext.extend(Ext.direct.Provider, {
\r
13 parseResponse: function(xhr){
\r
14 if(!Ext.isEmpty(xhr.responseText)){
\r
15 if(typeof xhr.responseText == 'object'){
\r
16 return xhr.responseText;
\r
18 return Ext.decode(xhr.responseText);
\r
23 getEvents: function(xhr){
\r
26 data = this.parseResponse(xhr);
\r
28 var event = new Ext.Direct.ExceptionEvent({
\r
31 code: Ext.Direct.exceptions.PARSE,
\r
32 message: 'Error parsing json response: \n\n ' + data
\r
37 if(Ext.isArray(data)){
\r
38 for(var i = 0, len = data.length; i < len; i++){
\r
39 events.push(Ext.Direct.createEvent(data[i]));
\r
42 events.push(Ext.Direct.createEvent(data));
\r