Frappe.call in webpage

Say my app name is ‘library’. Also, I have one web page say home page. I want to call frappe doc python method inside home page’s script section.

Can I do that?

what path I should specify in frappe.call?

I have tried as follows, but it gives error:
POST http://localhost:8080/ 500 (INTERNAL SERVER ERROR) jquery.min.js:4

frappe.call({
method: ‘library.library.doctype.library_form.library_form.getData’,
callback: function (res) {

}
});

I don’t know if this is related to your problem.
When I try to execute method in doctype folder with bench execute, the full path called is frappe.core.doctype… so it return error 500.

What I tried is to call from the same controller, e.g. from customdoc.js calls to customdoc.py (the doctype is customdoc)

Yes. This I know. But, what if I want to call method from any custom js file ? Is it possible to use frappe.call and what should be path then ? Do I have to import anything?

I’m not a programmer so my answer might not be accurate or even correct.

From do and learn customizing ERPNext, I think your method is already correct. And from documentation I also think that frappe.call can call server side script in any place. But it seems it is not the case.

So my way around is to put the py file in top directory (inside custom app) or in the public directory hierarchy.

I have found out… I can make call using $.ajax as well in frappe inside page’s script section

1 Like