Rushikesh
Rushikesh

Reputation: 117

How to call vuejs function from javascript function?

enter image description here

How to call order function from successCallback ? The code is vuejs

Upvotes: 0

Views: 240

Answers (1)

Michal Bieda
Michal Bieda

Reputation: 939

Would be easier if the code you posted would be complete but my guess is:

Use arrow functions

var successCallback = payment_id => {
    // now "this" refers to this vue component instance so:
    this.order()
}

or store reference to this and use it like a variable

var that = this
var successCallback = function (payment_id) {
    // this is *this* function
    // "that" is a vue instance
    that.order()
}

Upvotes: 1

Related Questions