Skip to content

Instantly share code, notes, and snippets.

@egrueter-dev
Created June 13, 2015 18:34
Show Gist options
  • Select an option

  • Save egrueter-dev/2e28393e9cd83e6e69a8 to your computer and use it in GitHub Desktop.

Select an option

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.
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