Currently I am trying to do a frappe call via javascript and assign it to a variable. This variable on javascript would be used to manipulate html file. Can anyone help me with this? Thanks!
Javascript code
function searchThru() {
var ans = 0;
var ans = frappe.call({
method: “organizational_management.organizational_management.doctype.position.position.testing”,
callback: function(r) {
ans = msgprint(r.message);
}})
}
Hey @rmehta, I am on development setup and have migrate and did bench restart but to no avail.
Is this issue arising because html --> javascript --> python as compared to the usual javascript --> python ?
Perhaps you can point me to any relevant source code for me to dig around?
Thank you!
Edit/ Updates:
I did a frappe.msgprint and the r.message comes out fine.
It is the assignment of varaible to ans that is not working fine.
I have also attempted. ans = r + ""; but to no avail
I know this is “late” but I bumped into this exact same problem. I am able to obtain a string from my python function called with JS and frappe.call, but I cannot access the string itself when calling the JavaScript function, simply getting [object Object]