I have created a template in templates directory the name of the file is program.html
i have button in that file
<button id="download">Download pdf</button>
now i want to send a ajax request to my program.py file which is located at
erpnext/erpnext/schools/program/program.py
what will be the path
in the below script
<script type="text/javascript">
var xhr = new XMLHttpRequest();
xhr.open("POST", '/api/method/frappe.utils.print_format.hi');
xhr.setRequestHeader("X-Frappe-CSRF-Token", frappe.csrf_token);
xhr.responseType = "arraybuffer";
xhr.onload = function(success) {
console.log("e");
if (this.status === 200) {
console.log("e");
var blob = new Blob([success.currentTarget.response], {type: "application/pdf"});
var objectUrl = URL.createObjectURL(blob);
//Open report in a new window
window.open(objectUrl);
}
};
<script>
please help