How can I pass data from .js to .py in my custom portal page

Hello,
I am new to frappe and I have created a new custom app(contacts-mis) where I have design a page in WWW named company with its corresponding .js & .py files and I was asking how to pass data from .js to .py since I want to use the string parms from the url in .py to fetch data(company contacts) from the database. Any help will be much appreciated.

Regards,

You can use frappe.call to send a POST request to your python endpoint. Here’s the documentation link for it.

Thank you for your response, based on the link you shared I think I asked my question in the wrong way. But if you don’t mind this is my use case & question:

  • I have a page that displays all companies and when one clicks on a company he must be redirected on that company’s page where there is that company’s info and contacts based on the name passed as a query string parameter.

So I was asking if there is a way I can get that query string params(name) in my controller since I am using context or if I can use .js file to get it and pass it on to my controller(.py)

href may resolve this issue if you have pages ready for doctype.

Otherwise just render company details on same page by pulling company info from python using frappe.call and clear / hide company listing while showing specific company details.

Thx @saurabh6790 that’s a great idea

I have successfully fetched data from my api using frappe.call but I don’t have any idea how to render it from .js would you please provide any resource that I can use