Create web service

In order to create an AJAX web service, use the AJAX Web Service Wizard. You will be able to call a server-side function (that you wrote) from JavaScript - the function or method of an object will be exported to the client as a JavaScript stub. To view a definition of this pattern, click here.

The AJAX Web Service Wizard is accessible from the MX AJAX Toolbox tab of the Insert bar (or MX AJAX Toolbox menu item from the Insert menu):

 

Note: You can achieve the same results with the AJAX Web Service server behavior, accessed from the Application panel, Server Behaviors -> + -> MX AJAX Toolbox. The wizard generates the server behavior in page as well.

 

The AJAX Web Service Wizard has two steps.

Configure the first step of the AJAX Web Service Wizard as shown below:

 

  1. Select the call type, either a function or a method.

  2. Specify the function/method name.

  3. If you call a method, specify the instantiated object name.

  4. All the passed parameters are displayed in the grid (type and value).

  5. Select the source from where the parameter gets its value.

  6. Select the page element from where the parameter gets its value.

  7. The buttons in the lower part of the interface (they appear on both steps of the wizard) offer the next functionalities:

  8. Click Next to continue configuring the wizard.

 

Configure the second step of the AJAX Web Service Wizard as shown below:

 

  1. Select the response container (destination type).

  2. Select the page element where the response will be displayed.

  3. Select the form element in page associated with the triggered action.

  4. Select the event that triggers the action.

 

Related Topics