Canvas Global Methods
canvas.ajax
The canvas.ajax JavaScript class provides a simple way to make Ajax requests with maximum flexibility. The canvas.ajax JS class provides three-parameters - Methods, Params, and URL.
The structure of this class is as follows:
canvas.ajax( { params : params, success : function(result) { }, failure : function(result, request) { } URL:'/Someurl' });
Here,
- Params: The params should typically contain the data to be submitted to the server along with the combination of Product Code, Sub Product Code, Function Code, and Action to route through the Canvas default flow.
- Success and Failure: These are the methods that handle the successful and unsuccessful submission of request.
- URL: This is an optional attribute. If URL is not provided, the request redirects to Canvas's WidgetControllerServlet.