Created
June 13, 2015 18:34
-
-
Save egrueter-dev/2e28393e9cd83e6e69a8 to your computer and use it in GitHub Desktop.
Making an Ajax request from an ember component. Had to set async to false in order to store the data in a persistent manner. Good to know.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default Ember.Component.extend({ | |
| //....// | |
| newClass: function() { | |
| var result; | |
| Ember.$.ajax({ | |
| url: '/api/surveygizmodata/1', | |
| async: false, | |
| type: 'GET', | |
| success: function(data) { | |
| result = data; | |
| } | |
| }); | |
| return result.completed_surveys + '/' + result.mentor_count | |
| }.property('newClass') | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment