Atozed Forums
ajaxCall question - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: ajaxCall question (/thread-1228.html)



ajaxCall question - joel - 09-10-2019

Can someone explain the parameters in the ajaxCall functions?

Thanks

iw15.1.4


RE: ajaxCall question - Jose Nilton Pace - 09-10-2019

function ajaxCall(ACallbackName, AParams, ALock);


RE: ajaxCall question - DanBarclay - 09-10-2019

Is this what you are looking for?

http://docs.atozed.com/docs.dll/development/Async%20callbacks%20in%20IntraWeb%2015.1.html

Dan


RE: ajaxCall question - joelcc - 09-10-2019

(09-10-2019, 06:38 PM)DanBarclay Wrote: Is this what you are looking for?

  http://docs.atozed.com/docs.dll/development/Async%20callbacks%20in%20IntraWeb%2015.1.html

Dan

Let me be more specific.   On the javascript call below the 3rd parameter is false.    What does this parameter control?

Code:
ajaxCall("Multiply", "&x=5&y=10", false, function(response) {alert("Result is: " + response);});



RE: ajaxCall question - kudzu - 09-10-2019

Quoted directly from the link that Dan posted:

"Multiply" function can be called from JavaScript using something as:


ajaxCall("Multiply", "&x=5&y=10", false, function(response) {alert("Result is: " + response);});


In the above example, the callback function receives 2 parameters named x and y, and multiply them. The result is put into aResult parameter (which is an out parameter) The difference here compared to old versions is that aResult string is returned to the browser as is, i.e. the response will contain a string representing the result of the multiplication of x by y only, nothing else. This makes much easier to interface with existing JavaScript libraries which expect specific responses (e.g. JSON strings).

The forth type of callback (TIWCallbackProc3) is the most flexible one. It allows you to set the result directly using variable aResult (as above) or still use TIWApplication.CallbackResponse object (as in IW 15.0), or yet, bypass the response completely setting aHandled parameter to True. Setting aHandled to True means that the user code is responsible for creating the reponse. In this case, IntraWeb will skip the execution of callback response code completely.


RE: ajaxCall question - joel - 09-11-2019

(09-10-2019, 10:01 PM)kudzu Wrote: Quoted directly from the link that Dan posted:

"Multiply" function can be called from JavaScript using something as:


ajaxCall("Multiply", "&x=5&y=10", false, function(response) {alert("Result is: " + response);});


In the above example, the callback function receives 2 parameters named x and y, and multiply them. The result is put into aResult parameter (which is an out parameter) The difference here compared to old versions is that aResult string is returned to the browser as is, i.e. the response will contain a string representing the result of the multiplication of x by y only, nothing else. This makes much easier to interface with existing JavaScript libraries which expect specific responses (e.g. JSON strings).

The forth type of callback (TIWCallbackProc3) is the most flexible one. It allows you to set the result directly using variable aResult (as above) or still use TIWApplication.CallbackResponse object (as in IW 15.0), or yet, bypass the response completely setting aHandled parameter to True. Setting aHandled to True means that the user code is responsible for creating the reponse. In this case, IntraWeb will skip the execution of callback response code completely.

Thanks for pointing it out.