Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Anonymous js function with callback to backend
#3
Thanks for your reply, please excuse my late reaction.

Callbacks I already use. What I would like to achieve is to return a value from the backend to the script. Unfortunately it is not visible how I can do that with ExecuteAjaxEvent.

It is important to return to the caller as I cannot initiate the rest of the function from within the Delphi part, especially if it is an attached anonymous function.

An other example would be to callback into the Backend on rightclick, get configuration for am menu from the backend then continue displaying that menu in JavaScript.



Code:
           $(this).on("contextmenu", function (e) {
                // return native menu if pressing control
                if (e.ctrlKey) return;
                //open menu
                var wurst = executeAjaxEvent("&id="+curID, null,"#{%htmlname%}.OnMenuCallback",
                        false, null, false);
                var $menu = $(settings.menuSelector)
                    .data("invokedOn", $(e.target))
                    .show()
                    .css({
                        position: "absolute",
                        left: getMenuPosition(e.clientX, 'width', 'scrollLeft'),
                        top: getMenuPosition(e.clientY, 'height', 'scrollTop')
                    })
               ...  
Reply


Messages In This Thread
RE: Anonymous js function with callback to backend - by mschumann - 08-19-2018, 04:08 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)