Have created js file in theme as below which would be called during form submission
jQuery(function($) {
$(‘#enrollFormID’).submit(function() {
event.preventDefault();
//data contains fname,lname,emailid
var data = jQuery(this).serialize();
data = “form_type=”+data;
$.ajax({
url: ‘/apps/subpath’,
type: ‘PUT’,
data: data,
dataType: ‘json’,
success: function (data) {
console.info(data);
}
Am using app proxy to forward the request having the path_prefix as “/apps/subpath” and proxyurl as “…/test”
In the app,
router.put(‘/test’, async (ctx) => {
}
The url /test is getting called, but how should i get the form data in the app.
Am able to get headers, querystring, path but not able to get the data which is passed via ajax call.
Can anyone help me to know if this is possible to fetch the data passed via ajax call for put/post method.
Can we use put/post method for using app proxy or is it used only for Get method.