sample ajax request
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
import { ajax } from 'discourse/lib/ajax';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
user: Ember.inject.controller(),
|
||||
username: Ember.computed.alias('user.model.username_lower'),
|
||||
email: Ember.computed.alias('user.model.email'),
|
||||
|
||||
actions: {
|
||||
choiceTest: function() {
|
||||
makePayment: function() {
|
||||
|
||||
ajax('/payments', { method: 'POST' }).then(() => {
|
||||
console.log(this);
|
||||
});
|
||||
|
||||
this.set('saved', true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
{{username}}
|
||||
</div>
|
||||
|
||||
<button class='btn btn-primary choice-btn' {{action "choiceTest"}}>
|
||||
click
|
||||
<button class='btn btn-primary payment-btn' {{action "makePayment"}}>
|
||||
make payment
|
||||
</button>
|
||||
|
||||
{{#if saved}}
|
||||
<div class="choice-response">Response happens</div>
|
||||
<div class="payment-response">Response happens</div>
|
||||
{{/if}}
|
||||
|
||||
Reference in New Issue
Block a user