How and when to use JSQuery.trigger from another JSQuery to get the data

I would like to know how and when to use a JSQuery.trigger() when the data of that JSQuery can be accessed simply by using JSQuery.data in another JSQuery

I have pruchase_order_qry which returns a order object on successful data processing or returns an error object {errocode:3000 , errmesg : "Error in order processing"}

I have another process_request_qry which calls above pruchase_order_qry.

Within process_request_qry, if I use below, I am able to get order object.
const ord_obj = pruchase_order_qry.data

But I am not sure whether this should be the case always. If so when would pruchase_order_qry.trigger() be used and how to get the data (order object) returned by this query to the calling query (ie. process_request_qry)

Thanks

I think I figured out how to use trigger()
let result = await pruchase_order_qry.trigger({
onSuccess: function (data) {
console.log("Successully ran!", data);
},
});
let mydata = await JSON.stringify(result)

2 Likes