Line | |
---|
1 | // This is the contents of ajaxDemo.js, the file to test.
|
---|
2 | var TwitterWidget = {
|
---|
3 | makeRequest: function() {
|
---|
4 | var self = this;
|
---|
5 |
|
---|
6 | $.ajax({
|
---|
7 | method: "GET",
|
---|
8 | url: "http://api.twitter.com/1/statuses/show/trevmex.json",
|
---|
9 | datatype: "json",
|
---|
10 | success: function (data) {
|
---|
11 | self.addDataToDOM(data);
|
---|
12 | }
|
---|
13 | });
|
---|
14 | },
|
---|
15 |
|
---|
16 | addDataToDOM: function(data) {
|
---|
17 | // does something
|
---|
18 | // We will mock this behavior with a spy.
|
---|
19 |
|
---|
20 | return data;
|
---|
21 | }
|
---|
22 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.