| 1 |
define([ |
| 2 |
"dojo/_base/declare", |
| 3 |
"dojo/_base/lang", |
| 4 |
"dojo/_base/xhr" |
| 5 |
], function(declare, lang, xhr){ |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
return declare("dojox.mobile.dh.UrlDataSource", null, { |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
text: "", |
| 15 |
|
| 16 |
_url: "", |
| 17 |
|
| 18 |
constructor: function( url){ |
| 19 |
|
| 20 |
|
| 21 |
this._url = url; |
| 22 |
}, |
| 23 |
|
| 24 |
getData: function(){ |
| 25 |
|
| 26 |
|
| 27 |
var obj = xhr.get({ |
| 28 |
url: this._url, |
| 29 |
handleAs: "text" |
| 30 |
}); |
| 31 |
obj.addCallback(lang.hitch(this, function(response, ioArgs){ |
| 32 |
this.text = response; |
| 33 |
})); |
| 34 |
obj.addErrback(function(error){ |
| 35 |
console.log("Failed to load "+this._url+"\n"+(error.description||error)); |
| 36 |
}); |
| 37 |
return obj; |
| 38 |
} |
| 39 |
}); |
| 40 |
}); |