As always, Sergiu saved my day :D. Indeed, now $msg.get() from javascript works fine in
xwiki, although usually it shouldn't work, as Catalin said (javascript is client-side
and velocity server-side) but in xwiki somehow really works.
Thanks again Sergiu. And of course, thank you all who answered my question.
It's a very nice community here at xwiki :D and I'm happy to be part of it.