Cannot call python method from JS

I don’t know what is happening but I cannot call the python method from JS. Here are my codes:

JS

frappe.ui.form.on(‘Agent Statement’, {
refresh: function(frm) {
},
match: function(frm) {
$.each(frm.doc.invoices || , function(i, d) {
frappe.call({
method: “atndesk.collections.doctype.agent_statement.agent_statement.match_invoice”,
args: {
invoice_no: d.invoice_no
},
callback(r) {
if(r.message) {
msgprint(r.message);
d.requested = 1;
d.request_reference = r.message;
}
}
});
});
}
});

Python

from future import unicode_literals
import frappe
from frappe.model.document import Document

class AgentStatement(Document):
pass

@frappe.whitelist()
def match_invoice(invoice_no):
console.log(“I am here!”)
inv = frappe.db.sql(“”“SELECT parent from tabOnline Payment Request Invoices
where reference_number = %s”“”, invoice_no, as_dict=1)

if inv:
return inv

in Python code, should be print(“I am here!”) rather than console.log(“I am here!”)

Edit:
Just make sure, you already wrapped table name in back-tick. And your triple quotes seem not right.

inv = frappe.db.sql("""SELECT parent from `tabOnline Payment Request Invoices`
where reference_number = %s""", invoice_no, as_dict=1)

Try this.

inv = frappe.db.sql("""
	SELECT 
		parent 
	FROM 
		`tabOnline Payment Request Invoices`
	WHERE 
		reference_number = '{}'
	;
	""".format(invoice_no), as_dict=1)

Funny, seems like the semicolon had got me here. Added in SQL and it woks. Thanks.