How to use the ghost/utils/ajax function in ghost

To help you get started, we’ve selected a few ghost examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TryGhost / Ghost-Admin / app / mixins / pagination-controller.js View on Github external
reportLoadError: function (response) {
        var message = 'A problem was encountered while loading more records';

        if (response) {
            // Get message from response
            message += ': ' + getRequestErrorMessage(response, true);
        } else {
            message += '.';
        }

        this.get('notifications').showAlert(message, {type: 'error'});
    },
github manuelmitasch / ghost-admin-ember-demo / app / routes / posts.js View on Github external
model: function() {
    return ajax("/ghost/api/v0.1/posts");
  },
github TryGhost / Ghost-Admin / app / controllers / forgotten.js View on Github external
this.validate({format: false}).then(function () {
                ajax({
                    url: self.get('ghostPaths.url').api('authentication', 'passwordreset'),
                    type: 'POST',
                    data: {
                        passwordreset: [{
                            email: data.email
                        }]
                    }
                }).then(function () {
                    self.toggleProperty('submitting');
                    self.notifications.showSuccess('Please check your email for instructions.', {delayed: delay});
                    self.set('email', '');
                    self.transitionToRoute('signin');
                }).catch(function (resp) {
                    self.toggleProperty('submitting');
                    self.notifications.showAPIError(resp, {defaultErrorText: 'There was a problem with the reset, please try again.'});
                });