3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.2.1
11 * Copyright(c) 2006-2010 Ext JS, Inc.
13 * http://www.extjs.com/license
15 <div id="cls-Ext.direct.JsonProvider"></div>/**
16 * @class Ext.direct.JsonProvider
17 * @extends Ext.direct.Provider
19 Ext.direct.JsonProvider = Ext.extend(Ext.direct.Provider, {
20 parseResponse: function(xhr){
21 if(!Ext.isEmpty(xhr.responseText)){
22 if(typeof xhr.responseText == 'object'){
23 return xhr.responseText;
25 return Ext.decode(xhr.responseText);
30 getEvents: function(xhr){
33 data = this.parseResponse(xhr);
35 var event = new Ext.Direct.ExceptionEvent({
38 code: Ext.Direct.exceptions.PARSE,
39 message: 'Error parsing json response: \n\n ' + data
44 if(Ext.isArray(data)){
45 for(var i = 0, len = data.length; i < len; i++){
46 events.push(Ext.Direct.createEvent(data[i]));
49 events.push(Ext.Direct.createEvent(data));