ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Web-specific functions / Ajax functions
  • Result of the server procedure
  • Procedures that can be called by AJAX
  • Older browsers
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Runs a server procedure without refreshing the page. This function is blocking. No process will be run as long as the procedure result run is not retrieved.
To avoid locking the processes, use AJAXExecuteAsynchronous.
// AJAX supporté sur le navigateur en cours?
IF AJAXDisponible() = True THEN
// Exécution de la procédure serveur "MaProc"
Res is string
Res = AJAXExécute(MaProc, IDProduit, VilleClient)
// Utilisation des données à modifier 
...
ELSE
// Traitements sans utilisation de AJAX 
... 
END
// -- Procédure serveur MaProc // --
// Procédure permettant de rechercher les données à modifier dans la page 
PROCÉDURE MaProc(RefProd, CVille)
// Recherche des données à modifier
...
// Renvoi du résultat
RETURN Résultat1
Syntax
<Result> = AJAXExecute([<Options>, ] <WLanguage procedure> [, <Parameter 1> [... [, <Parameter N>]]])
<Result>: Character string
Result of the <WLanguage procedure>. This result contains the data to modify in the page.
<Options>: Integer constant (or combination of constants)
Update mode:
ajaxPostValueOfControlsThe values of all the controls of the page must be sent to the server. The WLanguage procedure called will use the values of the controls that contain data entered by the user.
ajaxStraightCall
(default value)
Modified controls are not refreshed in the page.
ajaxSynchronizeServerVariablesThe Ajax call will send variables with the <Browser synchronized> attribute.
ajaxUpdateControlsModified controls are automatically refreshed in the page.
ajaxWithoutLockingAWPContextThe AWP context is not blocked during Ajax calls, so that calls can be parallelized..
In this case, it is forbidden to use the AWP context in called server procedures.
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).
<WLanguage procedure>: Procedure name
Name of server procedure to run (global or local procedure). This procedure is used to find the data to be modified in the page.
The result of this procedure must be a character string returned to the browser by the RETURN keyword. For more details, see the remarks.
This procedure must be allowed to be called by AJAX (see the Notes).
<Parameter 1>: Optional character string
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
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 the server procedure

<WLanguage procedure> is used to search for data to modify in the page. The result of this procedure corresponds to the data to modify.
To send this result back to the browser, use the RETURN keyword and specify:
  • the character string that contains the data.
  • the name of the XML document that contains 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.
Remark: 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 procedure bar:
Code that cannot be called by AJAX
Code that can be called by AJAX

Older browsers

AJAXAvailable is used to determine if the current browser supports AJAX technology. If a process that uses AJAX is run on a browser that does not support this technology, the process is run "as if" it did not use AJAX (e.g., the entire page is refreshed).
Business / UI classification: Neutral code
Component: WDJS.DLL
Minimum version required
  • Version 10
Comments
Click [Add] to post a comment

Last update: 11/23/2023

Send a report | Local help