3 <title>The source code</title>
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 <body onload="prettyPrint();">
8 <pre class="prettyprint lang-js">/*!
10 * Copyright(c) 2006-2009 Ext JS, LLC
12 * http://www.extjs.com/license
14 <div id="cls-Ext.direct.JsonProvider"></div>/**
\r
15 * @class Ext.direct.JsonProvider
\r
16 * @extends Ext.direct.Provider
\r
18 Ext.direct.JsonProvider = Ext.extend(Ext.direct.Provider, {
\r
19 parseResponse: function(xhr){
\r
20 if(!Ext.isEmpty(xhr.responseText)){
\r
21 if(typeof xhr.responseText == 'object'){
\r
22 return xhr.responseText;
\r
24 return Ext.decode(xhr.responseText);
\r
29 getEvents: function(xhr){
\r
32 data = this.parseResponse(xhr);
\r
34 var event = new Ext.Direct.ExceptionEvent({
\r
37 code: Ext.Direct.exceptions.PARSE,
\r
38 message: 'Error parsing json response: \n\n ' + data
\r
43 if(Ext.isArray(data)){
\r
44 for(var i = 0, len = data.length; i < len; i++){
\r
45 events.push(Ext.Direct.createEvent(data[i]));
\r
48 events.push(Ext.Direct.createEvent(data));
\r