Skip to content Skip to sidebar Skip to footer

Pass Button Value Using Javascript And Make It Usable In Xwiki Macro

So I have 2 buttons and each button click is supposed to call 2 different functions. I figured I can use Javascript to get the values but how do I get the value to be usable in a m

Solution 1:

You're trying to mix two completely different languages. One is executed on the server, one on the client, and there's no direct connection between them. Once the HTML reaches the browser, Velocity has long stopped executing, and you can't get back to it from JavaScript.

Well, not directly.

When you have to go back from JavaScript to Velocity, you usually send an XHR with some piece of information, back to the server. The document where you send the request will detect what kind of request you're sending (using a request parameter), will perform the requested action, and will generate a response to be sent back to the JavaScript side.

You can find an example in the blog categories management code.

Post a Comment for "Pass Button Value Using Javascript And Make It Usable In Xwiki Macro"