pui.submit( post data )



This API submits a specified response to the server. Usages include:

  • Profound.js application with a pure HTML front-end submitting data to a Node backend

  • Offline Mobile application submitting local storage data to the server once a connection with the server is reestablished

Parameters:

There are 3 ways basic ways to pass parameters to this API: a post data object parameter, no parameters, or a property name parameter with an optional value parameter.

The first parameter can be a JavaScript object with a set of name/value pairs that represent post data. However, if no parameters are passed or if the first parameter is not an object with post data, the post data is first captured from the screen’s current HTML content using the pui.captureData() API.

If the first parameter is a string property name, the property it is set on the captured data object to the second parameter (the value parameter). If the second parameter is not specified, a value of "1" is used.

Examples:

// Submit first and last name to the backend pui.submit({ "firstName": get("firstName"), "lastName": get("lastName") });   // Capture input data from HTML content and submit to Node.js pui.submit();   // Capture input data from HTML content, set *in03 to "1", and then submit to Node.js pui.submit("*in03");   // Capture input data from HTML content, set "exit" flag to "1", and then submit to Node.js pui.submit("exit");   // Capture input data from HTML content, set the "option" field to "5", and then submit to Node.js pui.submit("option", "5");   // Capture input data from HTML content, set multiple additional fields, and then submit var data = pui.captureData(); data.status = get("status"); data.flag = get("flag"); pui.submit(data);