Last modified: Mon, 04/03/2017 - 17:28
Javascript wrapper to help with handling of the JSON LASResponse object returned by the product server.
Overview
The LASResponse.js wrapper code parses a JSON response from a productserver.do request and packages the information in a LASResponse object to make it easier to access from javascript code.
If you are designing an AJAX style interface you will want to process the response with this wrapper. The LASContentCell.js component uses LASResponse.js heavily.
Documentation & Source
- API
- $LAS_HOME/WebContent/JavaScript/components/LASResponse.js
Examples
- $LAS/home/WebContent/productserver/templates/SlideSorter.vm
Here is a section from the SlideSorter Velocity template that is called with the JSON result from an AJAX productserver.do request.
The SlideSorter.vm also loads the json.js library which adds the parseJSON() method to every String. Please see json.org for more information on json.js.
// First, make sure we can parse the LASResponse
var Response;
try {
var JSONObject = LASResponseText.parseJSON();
Response = new LASResponse(JSONObject);
} catch(e) {
alert('Error parsing LASResponse: ' + e);
return;
}
Background
ddd