AJAX/JSON

As an example of the versatility of the combination of BIS and XML extensions, consider tutorial3, which is a BIS service program similar to the tutorial2 browse method that can produce either an XML response or, if the ACTION=JSON query parameter is included on the URL, the service program uses a different XSLT style sheet to export identical data in JSON (JavaScript Object Notation) format.

When invoked with a URL ending in tutorial3.srf?STARTSWITH=C the following XML is returned:

<?xml version="1.0" encoding="utf-8"?>
<companies>
   <company>
      <statecode>IA</statecode>
      <areacode>712</areacode>
      <officecode>723</officecode>
      <companyname>C-M-L TELEPHONE COOP. ASSN. OF MERIDEN,
      IOWA</companyname>
      <ratecenter>ARCHER</ratecenter>
      <assignmentcode>AS</assignmentcode>
   </company>
   <company>
      <statecode>TX</statecode>
      <areacode>512</areacode>
      <officecode>316</officecode>
      <companyname>C3 COMMUNICATIONS, INC. - TX</companyname>
      <ratecenter>AUSTIN</ratecenter>
      <assignmentcode>AS</assignmentcode>
   </company>
   <company>
      <statecode>MT</statecode>
      <areacode>406</areacode>
      <officecode>935</officecode>
      <companyname>CABLE &amp; COMMUNICATIONS
      CORPORATION</companyname>
      <ratecenter>BROADUS</ratecenter>
      <assignmentcode>AS</assignmentcode>
   </company>

When invoked with a URL ending in tutorial3.srf?STARTSWITH=C&ACTION=JSON the following text is returned:

{ "companies" : [
   {
    "statecode" : "IA",
    "areacode" : 712,
    "officecode" : 723,
    "companyname" : "C-M-L TELEPHONE COOP. ASSN. OF MERIDEN, IOWA",
    "ratecenter" : "ARCHER",
    "assignmentcode" : "AS"
   },
   {
    "statecode" : "TX",
    "areacode" : 512,
    "officecode" : 316,
    "companyname" : "C3 COMMUNICATIONS, INC. - TX",
    "ratecenter" : "AUSTIN",
    "assignmentcode" : "AS"
   },
   {
    "statecode" : "MT",
    "areacode" : 406,
    "officecode" : 935,
    "companyname" : "CABLE & COMMUNICATIONS CORPORATION",
    "ratecenter" : "BROADUS",
    "assignmentcode" : "AS"
   },

Additional usage examples may be found on the Micro Focus SupportLine Knowledge Base.