Making Ajax POST Request in Sage 300c Customizations
Here’s how to make a POST request, using Sage’s supplied ajaxPost function:
sg.utls.ajaxPost(url, { user: approverUserId, pw: approverPw, customerNumber: customerNumber}, HutilityOrderEntryCustomizationUICallback.jbtest);
Here we’re supplying it with a url, our post data, and a callback function to handle the response.
Originally we tried to make POST requests using JQuery, but ran into issues. After inspecting the requests in Chrome Dev Tools, we found that the Sage ajaxPost includes tokens in the request that must be acting as CSRF tokens.