I know that we can use Haskell data in the Julius-code, for example:
$(function(){
$("section.#{sectionClass}").hide();
});
But how can I use JS-variable in the Haskell code? For example:
... in some .julius
$(function set_global_variable( value ) {
window.myGlobalValue = value;
});
... in some handler, pseudocode:
getMyPageR :: Handler Html
getMyPageR = do
let globalValue = [julius|window.myGlobalValue;|]
...
Is it possible?
No, there's no way to do that. The yesod code runs server side, and the JavaScript client side. The only way to achieve that kind if thing is to have the JavaScript send values back to the server.