html input to custom menu

html input to custom menu

Dears,

I am adding a custom menu to run a python script for third party app integration. Also I want to take input from user through html and pass it to the script.

what I did so far:
  1. added html file in integration/resources with this content , also attached to be clearer

    <!DOCTYPE html>
    <html>
    <head>
    <script type="text/javascript" src="E:\abdo_yousri\jquery-3.5.1.min.js"></script>
    <title></title>
    </head>
    <body>
    <div>please enter attachment name</div>
    <div><input type="text" name="attachment_name"></div>
    <input type="button" value="submit" onclick="SubmitForm()">
    </body>
    <script>
      function SubmitForm()
      {
      alert(1);
      var attachment_name = JQuery("#attachment_name").val();
      alert(attachment_name);
      var data = {ATTACHMENT_NAME:attachment_name};
      var items = (typeof sdptoJSON != 'undefined') ? sdptoJSON(data) : JSON.stringify(data);
      JQuery.ajax({type:'POST',url:'/servlet/ActionExecutorServlet',data:{data:tems},
      success: function(response){
      alert(response)
      }
      });
      }
    </script>
    </html>

  2. in the custom menu script file to run I wrote: python script.py $COMPLETE_JSON_FILE $HTML_DATA_JSON_FILE

  3. I try to read input in the  script with this line : attachment_name= sys.argv[2]

I believe that the error is in the html file because I can't  alert attachment name. also I can't understand the last portion of the  js script and the role of servlet here.

I wish my discussion is clear and your help is appreciated because I am new to  jquery stuff.

cheers

                  New to ADSelfService Plus?