Send an AJAX Request

Restriction: This topic applies only when the Enterprise Server feature is enabled.

The service you have deployed can be accessed by client programs; however, browsers that support cross-origin resource sharing can fail in this endeavor. In this segment of the tutorial, you attempt to access the service using such a browser for the purpose of observing the results.

We provide a test script, bookAJAXtest.html, that contains an AJAX request. You run this script in a browser that supports CORS.

  1. In Windows Explorer, browse to the %PUBLIC%\Documents\Micro Focus\Enterprise Developer\Samples\Interface Mapping Toolkit\ServiceInterfaces\BookDemo directory.
  2. Open the bookAJAXtest.html file in a browser that supports cross-origin resource sharing.
  3. Click the Read radio button
  4. Type 1111 into the lnk_b_stockno field; then click Submit.

Nothing happens!

In fact, this is the expected result. The reason nothing happened is that your service interface's Allowed Origin field is empty, preventing the service from recognizing that your AJAX request is originating from an allowed source. The request and response are still being sent, but your browser is preventing you from seeing the response.

In the next segment, you correct this problem by enabling any Web site or user to make an AJAX request to a deployed service.