Anonymous web form response capture.

Hi,

I am new to the frape/ERPNext.

I have an anonymous web form published via the website module. On successful form submission I want user to show the acknowledgement, with fields which user has filled in the form and doc name which is generated on server side. I can see that all of these fields are available in http response

How to capture the http response using client script? as I am using public bench group I can not create a server api script.

I tried doing:

frappe.web_form.after_save = function(response) {
console.log(frappe.web_form.doc) // doesn't have "name" field 
console.log(response) // undefined 

However response is always undefined