Capture POST parameter in API

How can I get the value of POST parameter on a whitelisted API function ?

frappe.local.form_dict didn’t work for me.


also check frappe.form_dict

Nope, didn’t help. I’m getting empty response

{"message":"{'cmd':', 'data': u''}"}

To assist further in debugging, here’s how the data is POSTed

    <!DOCTYPE html>
    <meta charset="UTF-8">
      <form id="frmMain" action="http://localhost:8002/api/method/" method="post">
            <input type="submit" id="post_param_id" name="post_param_name" value="" />
  <script type="text/javascript">
    console.log("setting up...");
    document.getElementsByName('post_param_name').value = "checkkk";

The very confusing bit is, if I don’t use JS to set the value of input form, it works :confused: but my requirement is to use JS.

If you can use jQuery refer login page

1 Like