XINS - AJAX Example 3
Description
This page is a demo that call a XINS API and transform the result using XSLT on the client side.
This example requires the myproject API to run on your computer.
To run the myproject API, go to the demo\xins-project directory and execute xins run-myproject.
Form
Technical explanations
- This example uses the Sarissa Javascript library.
The library is imported by adding in the head section
<script type="text/javascript" src="sarissa.js"> </script>
- When you click on the Send button the Javascript method callMyFunction() is called.
- The callMyFunction() method call the XINS API synchroniously with the parameters filled in the form.
The result is stored in the xmlhttp variable.
- The XSLT is put in the xslDoc variable by parsing the XSLT string.
- The parameter color is passed to the style sheet with the value of the text field.
- The script does the XSLT transformation and put the resulted HTML at the specified place in the HTML page.
You can have a look at the source code of this HTML page to fully understand this example.
For security reason, this script works only locally with Internet Explorer or with other
browsers when the HTML page is hosted on the same server as the API.
Prev - Next