How to call synchronous ajax call in alfresco?

后端 未结 2 1574
天涯浪人
天涯浪人 2021-01-23 23:42

I have one custom property say XYZ. I want to validate it on blur event. I am calling one web-script using Ajax from JavaScript(Client) but its not waiting for

2条回答
  •  不要未来只要你来
    2021-01-24 00:24

    You need to use the callbacks available on the function as these are called after the operation has completed. You have one failureCallback and one successCallback.

    Here is an example of a JavaScript jsonPost function using a successCallback:

    Alfresco.util.Ajax.jsonPost(
        {
            url: Alfresco.constants.PROXY_URI + "my/webscript?nodeRef=" + nodeRef,
            successCallback: {
                fn: function (o) {
    
                    //Make further calls
    
                },
                scope: this
            },
            failureMessage: "Server Error"
        });
    

    If you want to block further code then you need to overwrite the relevant part of Alfresco and move the calls to the callback.

提交回复
热议问题