ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Your version: 01A240077F (WINDEV 24)

The content of this page has been updated to version 28.  See documentation 28 now.
Help / WLanguage / WLanguage functions / Functions specific to WEB / Ajax functions
  • Result of server procedure
  • Procedures that can be called by AJAX
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
AJAXExecute (Function)
In french: AJAXExecute
Runs a server procedure without refreshing the page. This function is locking. No process will be run as long as the procedure result run is not retrieved.
To avoid locking the processes, use AJAXExecuteAsynchronous.
Note: The former browsers do not support the AJAX technology (Internet Explorer 5.5 and later, FireFox 1.0 and later, Netscape 7 and later, Opera 8 and later, Safari 1.2 and later, ...). AJAXAvailable is used to find out whether the AJAX technology is supported by the current browser. If a process that is using the AJAX technology is run on a browser that does not support this technology, the process is run "as if" it did not use the AJAX technology (the entire page is refreshed for example).
// Is AJAX supported by the current browser?
IF AJAXAvailable() = True THEN
// Run the server procedure named "MyProc"
Res is string
Res = AJAXExecute(MyProc, ProductID, CustomerCity)
// Use the data to modify
...
ELSE
// Processes without using AJAX
...
END
// -- MyProc server procedure // --
// Procedure used to find the data to modify in the page
PROCEDURE MyProc(ProductRef, CCity)
// Find the data to modify
...
// Return the result
RESULT Result1
Syntax
<Result> = AJAXExecute([<Options>, ] <Procedure name> [, <Parameter 1> [... [, <Parameter N>]]])
<Result>: Character string
Result of <Procedure name>. This result contains the data to modify in the page.
<Options>: Integer constant
Update mode:
ajaxUpdateControlsThe modified controls are automatically refreshed in the page.
ajaxStraightCall
(default value)
The modified controls are not refreshed in the page.
ajaxWithoutLockingAWPContextThe Ajax call will not use the AWP context therefore this context will not be locked. Used to parallelize the Ajax calls on the server.
Caution: This constant has no effect in page or project GO.

Caution: these constants must be used directly (no variable can be used to store their value).
<Procedure name>: Character string (with or without quotes)
Name of server procedure to run (global or local procedure). This procedure is used to find the data to modify in the page.
The result of this procedure must be a character string returned to the browser by the keyword RESULT. See remarks for more details.
This procedure must be allowed to be called by AJAX (see the Notes).
<Parameter 1>: Optional character string (with quotes)
First parameter passed to <Procedure name>.
Caution: Only simple types can be used (character string, integer, etc.). Structured types cannot be used.
<Parameter N>: Optional character string (with quotes)
Nth parameter passed to <Procedure name>.
Caution: Only simple types can be used (character string, integer, etc.). Structured types cannot be used.
Remarks

Result of server procedure

The server procedure <Procedure name> is used to find the data to modify in the page. The result of this procedure (which means the data to modify) can be contained in a character string or in an XML document (created and handled by the XML functions).
To send this result to the browser, simply use the keyword RESULT, specifying:
  • the character string containing the data.
  • the name of XML document containing the data.
This result will be automatically contained in the <Result> parameter of AJAXExecute. Then, this result must be managed to refresh the data to modify.
If this result corresponds to the name of an XML document, this document will be automatically transmitted and created on the browser. Then, this document can be handled by the XML functions.
Note: When using an XML document:
  • the XML document is not automatically deleted from the server when it is transmitted to the browser.
  • if an XML document with the same name is already found on the browser, the new XML document automatically replaces the former one.

Procedures that can be called by AJAX

To secure the WEBDEV sites, the server procedures are protected from illegal calls (attempt to re-route a session for example). To run a server procedure from a browser process (AJAXExecute or AJAXExecuteAsynchronous), you must allow this procedure to be called by AJAX.
To allow a server procedure to be called by AJAX, click "AJAX" in the bar of procedure:
Procedure that cannot be called by AJAX
Procedure that can be called by AJAX
Component : WDJS.DLL
Minimum version required
  • Version 10
Comments
Click [Add] to post a comment

Last update: 07/05/2019

Send a report | Local help